From df64d82cca2ee371da5e8c03c227457069ae663e Mon Sep 17 00:00:00 2001 From: Jesse Rushlow <40327885+jrushlow@users.noreply.github.com> Date: Tue, 20 Feb 2024 05:51:53 -0500 Subject: [PATCH] [ci] php-cs-fixer it up (#283) --- src/Exception/TooManyPasswordRequestsException.php | 2 +- src/Generator/ResetPasswordTokenGenerator.php | 2 +- src/Model/ResetPasswordToken.php | 2 +- src/ResetPasswordHelper.php | 4 ++-- tests/ResetPasswordTestKernel.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Exception/TooManyPasswordRequestsException.php b/src/Exception/TooManyPasswordRequestsException.php index e35b7709..52c1e08f 100644 --- a/src/Exception/TooManyPasswordRequestsException.php +++ b/src/Exception/TooManyPasswordRequestsException.php @@ -16,7 +16,7 @@ final class TooManyPasswordRequestsException extends \Exception implements Reset { private $availableAt; - public function __construct(\DateTimeInterface $availableAt, string $message = '', int $code = 0, \Throwable $previous = null) + public function __construct(\DateTimeInterface $availableAt, string $message = '', int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Generator/ResetPasswordTokenGenerator.php b/src/Generator/ResetPasswordTokenGenerator.php index 96c53820..83b0648e 100644 --- a/src/Generator/ResetPasswordTokenGenerator.php +++ b/src/Generator/ResetPasswordTokenGenerator.php @@ -43,7 +43,7 @@ public function __construct(string $signingKey, ResetPasswordRandomGenerator $ge * @param mixed $userId Unique user identifier * @param string $verifier Only required for token comparison */ - public function createToken(\DateTimeInterface $expiresAt, $userId, string $verifier = null): ResetPasswordTokenComponents + public function createToken(\DateTimeInterface $expiresAt, $userId, ?string $verifier = null): ResetPasswordTokenComponents { if (null === $verifier) { $verifier = $this->randomGenerator->getRandomAlphaNumStr(); diff --git a/src/Model/ResetPasswordToken.php b/src/Model/ResetPasswordToken.php index ad87b0cf..0b5b3eba 100644 --- a/src/Model/ResetPasswordToken.php +++ b/src/Model/ResetPasswordToken.php @@ -35,7 +35,7 @@ final class ResetPasswordToken */ private $transInterval = 0; - public function __construct(string $token, \DateTimeInterface $expiresAt, int $generatedAt = null) + public function __construct(string $token, \DateTimeInterface $expiresAt, ?int $generatedAt = null) { $this->token = $token; $this->expiresAt = $expiresAt; diff --git a/src/ResetPasswordHelper.php b/src/ResetPasswordHelper.php index ab0dd6b3..55c0389d 100644 --- a/src/ResetPasswordHelper.php +++ b/src/ResetPasswordHelper.php @@ -60,7 +60,7 @@ public function __construct(ResetPasswordTokenGenerator $generator, ResetPasswor * * @throws TooManyPasswordRequestsException */ - public function generateResetToken(object $user, int $resetRequestLifetime = null): ResetPasswordToken + public function generateResetToken(object $user, ?int $resetRequestLifetime = null): ResetPasswordToken { $this->resetPasswordCleaner->handleGarbageCollection(); @@ -159,7 +159,7 @@ public function getTokenLifetime(): int * * This method should not be used when timing attacks are a concern. */ - public function generateFakeResetToken(int $resetRequestLifetime = null): ResetPasswordToken + public function generateFakeResetToken(?int $resetRequestLifetime = null): ResetPasswordToken { $resetRequestLifetime = $resetRequestLifetime ?? $this->resetRequestLifetime; $expiresAt = new \DateTimeImmutable(sprintf('+%d seconds', $resetRequestLifetime)); diff --git a/tests/ResetPasswordTestKernel.php b/tests/ResetPasswordTestKernel.php index 1e99786f..ccbae0a2 100644 --- a/tests/ResetPasswordTestKernel.php +++ b/tests/ResetPasswordTestKernel.php @@ -36,7 +36,7 @@ class ResetPasswordTestKernel extends Kernel * @param array $routes Routes to be added to the container e.g. ['name' => 'path'] * @param BundleInterface[] $bundles Additional bundles to be registered e.g. [new Bundle()] */ - public function __construct(ContainerBuilder $builder = null, array $routes = [], array $bundles = []) + public function __construct(?ContainerBuilder $builder = null, array $routes = [], array $bundles = []) { $this->builder = $builder; $this->routes = $routes;