Skip to content

Commit

Permalink
Apply Code Style Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yivi authored and github-actions[bot] committed Dec 19, 2023
1 parent 77fe8b8 commit aaa0e81
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/Console/PurgeExpiredTokensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Yivoff\JwtRefreshBundle\Contracts\PurgableRefreshTokenProviderInterface;
use Yivoff\JwtRefreshBundle\Contracts\RefreshTokenProviderInterface;


#[AsCommand('yivoff:jwt_refresh:purge_expired_tokens')]
class PurgeExpiredTokensCommand extends Command
{
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/YivoffJwtRefreshExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Yivoff\JwtRefreshBundle\Shared\Hasher;
use Yivoff\JwtRefreshBundle\Shared\TokenIdGenerator;
use Yivoff\JwtRefreshBundle\YivoffJwtRefreshBundle;

use function class_exists;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Event/JwtRefreshTokenFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@

class JwtRefreshTokenFailed
{
public function __construct(public readonly FailType $failType, public readonly ?string $tokenId, public readonly ?string $userIdentifier)
{
}
public function __construct(public readonly FailType $failType, public readonly ?string $tokenId, public readonly ?string $userIdentifier) {}
}
4 changes: 1 addition & 3 deletions src/Event/JwtRefreshTokenSucceeded.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@

class JwtRefreshTokenSucceeded
{
public function __construct(public readonly string $tokenId, public readonly string $userIdentifier)
{
}
public function __construct(public readonly string $tokenId, public readonly string $userIdentifier) {}
}
3 changes: 1 addition & 2 deletions src/EventListener/AttachRefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
private string $parameterName,
private int $tokenShelfLife,
private RefreshTokenProviderInterface $refreshTokenProvider
) {
}
) {}

public function __invoke(AuthenticationSuccessEvent $event): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Model/RefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
*/
class RefreshToken implements RefreshTokenInterface
{
public function __construct(private string $username, private string $identifier, private string $verifier, private DateTimeImmutable $validUntil)
{
}
public function __construct(private string $username, private string $identifier, private string $verifier, private DateTimeImmutable $validUntil) {}

public function getUsername(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Security/Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Yivoff\JwtRefreshBundle\Exception\TokenExpiredException;
use Yivoff\JwtRefreshBundle\Exception\TokenInvalidException;
use Yivoff\JwtRefreshBundle\Exception\TokenNotFoundException;

use function explode;
use function str_contains;
use function time;
Expand All @@ -35,8 +36,7 @@ public function __construct(
private RefreshTokenProviderInterface $tokenProvider,
private EventDispatcherInterface $eventDispatcher,
private string $parameterName
) {
}
) {}

public function authenticate(HttpFoundation\Request $request): Passport
{
Expand Down
5 changes: 2 additions & 3 deletions src/Shared/Hasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Yivoff\JwtRefreshBundle\Shared;

use Yivoff\JwtRefreshBundle\Contracts\HasherInterface;

use function hash_equals;
use function hash_hmac;

Expand All @@ -13,9 +14,7 @@
*/
final class Hasher implements HasherInterface
{
public function __construct(private string $hash_key)
{
}
public function __construct(private string $hash_key) {}

public function verify(string $token, string $hash): bool
{
Expand Down
1 change: 1 addition & 0 deletions src/Shared/TokenIdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Yivoff\JwtRefreshBundle\Shared;

use Yivoff\JwtRefreshBundle\Contracts\TokenIdGeneratorInterface;

use function str_repeat;
use function str_shuffle;
use function substr;
Expand Down
1 change: 1 addition & 0 deletions tests/DependencyInjection/BundleInitializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @internal
*
* @coversNothing
*/
class BundleInitializationTest extends KernelTestCase
Expand Down
3 changes: 1 addition & 2 deletions tests/Resource/Autowired.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
private TokenIdGeneratorInterface $generator,
private Authenticator $authenticator,
private AttachRefreshToken $eventListener
) {
}
) {}

public function getEncoder(): HasherInterface
{
Expand Down
1 change: 1 addition & 0 deletions tests/Resource/InMemoryRefreshTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use InvalidArgumentException;
use Yivoff\JwtRefreshBundle\Contracts\RefreshTokenInterface;
use Yivoff\JwtRefreshBundle\Contracts\RefreshTokenProviderInterface;

use function array_key_exists;

class InMemoryRefreshTokenProvider implements RefreshTokenProviderInterface
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/AttachRefreshTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Yivoff\JwtRefreshBundle\Contracts\RefreshTokenInterface;
use Yivoff\JwtRefreshBundle\EventListener\AttachRefreshToken;
use Yivoff\JwtRefreshBundle\Test\Resource\InMemoryRefreshTokenProvider;

use function explode;

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/EventDispatcherSpy.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use InvalidArgumentException;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

use function array_key_exists;

class EventDispatcherSpy implements EventDispatcherInterface
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/MockerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Yivoff\JwtRefreshBundle\Contracts\HasherInterface;
use Yivoff\JwtRefreshBundle\Contracts\TokenIdGeneratorInterface;

use function random_int;
use function str_repeat;

Expand All @@ -14,9 +15,7 @@ trait MockerTrait
private function createHasher(bool $success = true): HasherInterface
{
return new class($success) implements HasherInterface {
public function __construct(private bool $success)
{
}
public function __construct(private bool $success) {}

public function hash(string $token): string
{
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/TokenIdGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use PHPUnit\Framework\TestCase;
use Yivoff\JwtRefreshBundle\Shared\TokenIdGenerator;

use function strlen;

/**
Expand Down

0 comments on commit aaa0e81

Please sign in to comment.