Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit d4b2fedd authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

Merge branch 'improve-coding-standards' into 'main'

Improve coding standards

See merge request !11
parents 2341448d afcb31ed
No related branches found
No related tags found
1 merge request!11Improve coding standards
......@@ -19,10 +19,10 @@ use Illuminate\Contracts\Auth\UserProvider;
final class EcasUserProvider implements UserProvider
{
public function __construct(
private CasUserProvider $casUserProvider
private readonly CasUserProvider $casUserProvider
) {}
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false) {}
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void {}
public function retrieveByCredentials(array $credentials): ?Authenticatable
{
......@@ -35,12 +35,12 @@ final class EcasUserProvider implements UserProvider
return new EcasUser($maybeUser);
}
public function retrieveById($identifier)
public function retrieveById(mixed $identifier): ?Authenticatable
{
return null;
}
public function retrieveByToken($identifier, $token)
public function retrieveByToken(mixed $identifier, $token): ?Authenticatable
{
return null;
}
......@@ -50,9 +50,9 @@ final class EcasUserProvider implements UserProvider
return $this->casUserProvider->retrieveCasUser();
}
public function updateRememberToken(Authenticatable $user, $token) {}
public function updateRememberToken(Authenticatable $user, $token): void {}
public function validateCredentials(Authenticatable $user, array $credentials)
public function validateCredentials(Authenticatable $user, array $credentials): bool
{
return true;
}
......
......@@ -18,7 +18,7 @@ use function array_key_exists;
final class EcasUser implements Authenticatable
{
public function __construct(private CasUser $user) {}
public function __construct(private readonly CasUser $user) {}
public function __toString(): string
{
......@@ -55,7 +55,7 @@ final class EcasUser implements Authenticatable
return null;
}
public function getAuthPasswordName() {}
public function getAuthPasswordName(): void {}
public function getGroups(): array
{
......
......@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace EcPhp\LaravelEcas\Tests\Providers;
use GuzzleHttp\Client;
// use Illuminate\Support\ServiceProvider;
use loophp\psr17\Psr17;
use loophp\psr17\Psr17Interface;
use Nyholm\Psr7\Factory\Psr17Factory;
......
......@@ -14,6 +14,7 @@ namespace EcPhp\LaravelEcas\Tests;
use EcPhp\LaravelCas\Providers\AppServiceProvider;
use EcPhp\LaravelEcas\Providers\LaravelEcasProvider;
use EcPhp\LaravelEcas\Tests\Providers\LaravelCasProvider;
use Illuminate\Foundation\Application;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use function dirname;
......@@ -26,11 +27,11 @@ abstract class TestCase extends OrchestraTestCase
/**
* Get application package providers.
*
* @param \Illuminate\Foundation\Application $app
* @param Application $app
*
* @return array
* @return list<class-string>
*/
protected function getPackageProviders($app)
protected function getPackageProviders($app): array
{
$config = include dirname(__DIR__) . '/vendor/ecphp/laravel-cas/src/publishers/config/laravel-cas.php';
config(['laravel-cas' => $config]);
......
......@@ -9,11 +9,12 @@
declare(strict_types=1);
namespace Tests\Unit;
namespace EcPhp\LaravelEcas\Tests\Unit;
use EcPhp\CasLib\Contract\CasInterface;
use EcPhp\Ecas\Ecas;
use EcPhp\LaravelEcas\Tests\TestCase;
use Illuminate\Contracts\Container\BindingResolutionException;
/**
* @internal
......@@ -22,9 +23,7 @@ use EcPhp\LaravelEcas\Tests\TestCase;
*/
final class CasInterfaceTest extends TestCase
{
private $response;
public function testIfEcas()
public function testIfEcas(): void
{
$casInterface = app()->make(CasInterface::class);
self::assertInstanceOf(Ecas::class, $casInterface);
......
......@@ -9,9 +9,10 @@
declare(strict_types=1);
namespace Tests\Unit;
namespace EcPhp\LaravelEcas\Tests\Unit;
use EcPhp\LaravelEcas\Tests\TestCase;
use Illuminate\Testing\TestResponse;
/**
* @internal
......@@ -20,7 +21,7 @@ use EcPhp\LaravelEcas\Tests\TestCase;
*/
final class ProxyCallBackControllerTest extends TestCase
{
private $response;
private TestResponse $response;
protected function setUp(): void
{
......@@ -28,12 +29,12 @@ final class ProxyCallBackControllerTest extends TestCase
$this->response = $this->get(route('laravel-cas-proxy-callback'));
}
public function testIfNotFalse()
public function testIfNotFalse(): void
{
self::assertNotFalse($this->response);
}
public function testIfXml()
public function testIfXml(): void
{
$xml = '<?xml version="1.0" encoding="utf-8"?><proxySuccess xmlns="http://www.yale.edu/tp/casClient" />';
self::assertEquals($xml, $this->response->getContent());
......
......@@ -22,8 +22,6 @@ declare(strict_types=1);
*/
require __DIR__ . '/../vendor/autoload.php';
// require __DIR__ . '/helpers.php';
// require __DIR__ . '/../src/Helpers/helpers.php';
use Carbon\Carbon;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment