Skip to content

Commit

Permalink
Merge branch 'improve-coding-standards' into 'main'
Browse files Browse the repository at this point in the history
Improve coding standards

See merge request ecphp/laravel-ecas!11
  • Loading branch information
drupol committed Nov 14, 2024
2 parents 2341448 + afcb31e commit d4b2fed
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
12 changes: 6 additions & 6 deletions src/Auth/EcasUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
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 {}

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 25 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::rehashPasswordIfRequired() has parameter $credentials with no value type specified in iterable type array.

public function retrieveByCredentials(array $credentials): ?Authenticatable

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 27 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::retrieveByCredentials() has parameter $credentials with no value type specified in iterable type array.
{
Expand All @@ -35,12 +35,12 @@ public function retrieveByCredentials(array $credentials): ?Authenticatable
return new EcasUser($maybeUser);

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.

Check failure on line 35 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Parameter #1 $user of class EcPhp\LaravelEcas\Auth\User\EcasUser constructor expects EcPhp\LaravelCas\Auth\User\CasUser, Illuminate\Contracts\Auth\Authenticatable given.
}

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;
}
Expand All @@ -50,9 +50,9 @@ public function retrieveCasUser(): ?Authenticatable
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

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (ubuntu-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.3)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.2)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.

Check failure on line 55 in src/Auth/EcasUserProvider.php

View workflow job for this annotation

GitHub Actions / Unit Tests (macOS-latest, 8.1)

Method EcPhp\LaravelEcas\Auth\EcasUserProvider::validateCredentials() has parameter $credentials with no value type specified in iterable type array.
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Auth/User/EcasUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

final class EcasUser implements Authenticatable
{
public function __construct(private CasUser $user) {}
public function __construct(private readonly CasUser $user) {}

public function __toString(): string
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public function getAuthPassword(): ?string
return null;
}

public function getAuthPasswordName() {}
public function getAuthPasswordName(): void {}

public function getGroups(): array
{
Expand Down
1 change: 0 additions & 1 deletion tests/Providers/LaravelCasProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;
Expand Down
7 changes: 4 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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;
Expand All @@ -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]);
Expand Down
7 changes: 3 additions & 4 deletions tests/Unit/CasInterfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,9 +23,7 @@
*/
final class CasInterfaceTest extends TestCase
{
private $response;

public function testIfEcas()
public function testIfEcas(): void
{
$casInterface = app()->make(CasInterface::class);
self::assertInstanceOf(Ecas::class, $casInterface);
Expand Down
9 changes: 5 additions & 4 deletions tests/Unit/ProxyCallBackControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,20 +21,20 @@
*/
final class ProxyCallBackControllerTest extends TestCase
{
private $response;
private TestResponse $response;

protected function setUp(): void
{
parent::setUp();
$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());
Expand Down
2 changes: 0 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/

require __DIR__ . '/../vendor/autoload.php';
// require __DIR__ . '/helpers.php';
// require __DIR__ . '/../src/Helpers/helpers.php';

use Carbon\Carbon;

Expand Down

0 comments on commit d4b2fed

Please sign in to comment.