Skip to content

Commit 3cbacef

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent bba8c98 commit 3cbacef

19 files changed

+25
-25
lines changed

Authentication/AuthenticationTrustResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class AuthenticationTrustResolver implements AuthenticationTrustResolverInterface
2424
{
25-
public function isAuthenticated(TokenInterface $token = null): bool
25+
public function isAuthenticated(?TokenInterface $token = null): bool
2626
{
2727
return $token && $token->getUser()
2828
// @deprecated since Symfony 5.4, TokenInterface::isAuthenticated() and AnonymousToken no longer exists in 6.0
@@ -32,7 +32,7 @@ public function isAuthenticated(TokenInterface $token = null): bool
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function isAnonymous(TokenInterface $token = null/* , $deprecation = true */)
35+
public function isAnonymous(?TokenInterface $token = null/* , $deprecation = true */)
3636
{
3737
if (1 === \func_num_args() || false !== func_get_arg(1)) {
3838
trigger_deprecation('symfony/security-core', '5.4', 'The "%s()" method is deprecated, use "isAuthenticated()" or "isFullFledged()" if you want to check if the request is (fully) authenticated.', __METHOD__);
@@ -44,15 +44,15 @@ public function isAnonymous(TokenInterface $token = null/* , $deprecation = true
4444
/**
4545
* {@inheritdoc}
4646
*/
47-
public function isRememberMe(TokenInterface $token = null)
47+
public function isRememberMe(?TokenInterface $token = null)
4848
{
4949
return $token && $token instanceof RememberMeToken;
5050
}
5151

5252
/**
5353
* {@inheritdoc}
5454
*/
55-
public function isFullFledged(TokenInterface $token = null)
55+
public function isFullFledged(?TokenInterface $token = null)
5656
{
5757
return $token && !$this->isAnonymous($token, false) && !$this->isRememberMe($token);
5858
}

Authentication/AuthenticationTrustResolverInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ interface AuthenticationTrustResolverInterface
3232
*
3333
* @deprecated since Symfony 5.4, use !isAuthenticated() instead
3434
*/
35-
public function isAnonymous(TokenInterface $token = null);
35+
public function isAnonymous(?TokenInterface $token = null);
3636

3737
/**
3838
* Resolves whether the passed token implementation is authenticated
3939
* using remember-me capabilities.
4040
*
4141
* @return bool
4242
*/
43-
public function isRememberMe(TokenInterface $token = null);
43+
public function isRememberMe(?TokenInterface $token = null);
4444

4545
/**
4646
* Resolves whether the passed token implementation is fully authenticated.
4747
*
4848
* @return bool
4949
*/
50-
public function isFullFledged(TokenInterface $token = null);
50+
public function isFullFledged(?TokenInterface $token = null);
5151
}

Authentication/Token/Storage/TokenStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getToken()
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function setToken(TokenInterface $token = null)
46+
public function setToken(?TokenInterface $token = null)
4747
{
4848
if ($token) {
4949
// ensure any initializer is called

Authentication/Token/Storage/TokenStorageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ public function getToken();
3232
*
3333
* @param TokenInterface|null $token A TokenInterface token, or null if no further authentication information should be stored
3434
*/
35-
public function setToken(TokenInterface $token = null);
35+
public function setToken(?TokenInterface $token = null);
3636
}

Authentication/Token/Storage/UsageTrackingTokenStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getToken(): ?TokenInterface
5050
/**
5151
* {@inheritdoc}
5252
*/
53-
public function setToken(TokenInterface $token = null): void
53+
public function setToken(?TokenInterface $token = null): void
5454
{
5555
$this->storage->setToken($token);
5656

Authorization/ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ExpressionLanguage extends BaseExpressionLanguage
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
35+
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
3636
{
3737
// prepend the default provider to let users override it easily
3838
array_unshift($providers, new ExpressionLanguageProvider());

Authorization/Voter/ExpressionVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ExpressionVoter implements CacheableVoterInterface
3131
private $authChecker;
3232
private $roleHierarchy;
3333

34-
public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, AuthorizationCheckerInterface $authChecker, RoleHierarchyInterface $roleHierarchy = null)
34+
public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, AuthorizationCheckerInterface $authChecker, ?RoleHierarchyInterface $roleHierarchy = null)
3535
{
3636
$this->expressionLanguage = $expressionLanguage;
3737
$this->trustResolver = $trustResolver;

Encoder/NativePasswordEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSalti
3131
/**
3232
* @param string|null $algo An algorithm supported by password_hash() or null to use the stronger available algorithm
3333
*/
34-
public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algo = null)
34+
public function __construct(?int $opsLimit = null, ?int $memLimit = null, ?int $cost = null, ?string $algo = null)
3535
{
3636
$this->hasher = new NativePasswordHasher($opsLimit, $memLimit, $cost, $algo);
3737
}

Encoder/PasswordHasherAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public function __construct(PasswordEncoderInterface $passwordEncoder)
2929
$this->passwordEncoder = $passwordEncoder;
3030
}
3131

32-
public function hash(string $plainPassword, string $salt = null): string
32+
public function hash(string $plainPassword, ?string $salt = null): string
3333
{
3434
return $this->passwordEncoder->encodePassword($plainPassword, $salt);
3535
}
3636

37-
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
37+
public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
3838
{
3939
return $this->passwordEncoder->isPasswordValid($hashedPassword, $plainPassword, $salt);
4040
}

Encoder/SodiumPasswordEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti
2828
{
2929
use LegacyEncoderTrait;
3030

31-
public function __construct(int $opsLimit = null, int $memLimit = null)
31+
public function __construct(?int $opsLimit = null, ?int $memLimit = null)
3232
{
3333
$this->hasher = new SodiumPasswordHasher($opsLimit, $memLimit);
3434
}

Exception/AccessDeniedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AccessDeniedException extends RuntimeException
2121
private $attributes = [];
2222
private $subject;
2323

24-
public function __construct(string $message = 'Access Denied.', \Throwable $previous = null)
24+
public function __construct(string $message = 'Access Denied.', ?\Throwable $previous = null)
2525
{
2626
parent::__construct($message, 403, $previous);
2727
}

Exception/AuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AuthenticationException extends RuntimeException
2626

2727
private $token;
2828

29-
public function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
29+
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null)
3030
{
3131
unset($this->serialized);
3232
parent::__construct($message, $code, $previous);

Exception/CustomUserMessageAccountStatusException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CustomUserMessageAccountStatusException extends AccountStatusException
2727

2828
private $messageData = [];
2929

30-
public function __construct(string $message = '', array $messageData = [], int $code = 0, \Throwable $previous = null)
30+
public function __construct(string $message = '', array $messageData = [], int $code = 0, ?\Throwable $previous = null)
3131
{
3232
parent::__construct($message, $code, $previous);
3333

Exception/CustomUserMessageAuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CustomUserMessageAuthenticationException extends AuthenticationException
2626

2727
private $messageData = [];
2828

29-
public function __construct(string $message = '', array $messageData = [], int $code = 0, \Throwable $previous = null)
29+
public function __construct(string $message = '', array $messageData = [], int $code = 0, ?\Throwable $previous = null)
3030
{
3131
parent::__construct($message, $code, $previous);
3232

Exception/LogoutException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class LogoutException extends RuntimeException
2020
{
21-
public function __construct(string $message = 'Logout Exception', \Throwable $previous = null)
21+
public function __construct(string $message = 'Logout Exception', ?\Throwable $previous = null)
2222
{
2323
parent::__construct($message, 403, $previous);
2424
}

Exception/TooManyLoginAttemptsAuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TooManyLoginAttemptsAuthenticationException extends AuthenticationExceptio
2121
{
2222
private $threshold;
2323

24-
public function __construct(int $threshold = null)
24+
public function __construct(?int $threshold = null)
2525
{
2626
$this->threshold = $threshold;
2727
}

Signature/SignatureHasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SignatureHasher
3535
* @param ExpiredSignatureStorage|null $expiredSignaturesStorage If provided, secures a sequence of hashes that are expired
3636
* @param int|null $maxUses Used together with $expiredSignatureStorage to allow a maximum usage of a hash
3737
*/
38-
public function __construct(PropertyAccessorInterface $propertyAccessor, array $signatureProperties, string $secret, ExpiredSignatureStorage $expiredSignaturesStorage = null, int $maxUses = null)
38+
public function __construct(PropertyAccessorInterface $propertyAccessor, array $signatureProperties, string $secret, ?ExpiredSignatureStorage $expiredSignaturesStorage = null, ?int $maxUses = null)
3939
{
4040
$this->propertyAccessor = $propertyAccessor;
4141
$this->signatureProperties = $signatureProperties;

Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class ConcreteToken extends AbstractToken
359359
{
360360
private $credentials = 'credentials_value';
361361

362-
public function __construct(array $roles = [], UserInterface $user = null)
362+
public function __construct(array $roles = [], ?UserInterface $user = null)
363363
{
364364
parent::__construct($roles);
365365

Validator/Constraints/UserPassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class UserPassword extends Constraint
2323
public $message = 'This value should be the user\'s current password.';
2424
public $service = 'security.validator.user_password';
2525

26-
public function __construct(array $options = null, string $message = null, string $service = null, array $groups = null, $payload = null)
26+
public function __construct(?array $options = null, ?string $message = null, ?string $service = null, ?array $groups = null, $payload = null)
2727
{
2828
parent::__construct($options, $groups, $payload);
2929

0 commit comments

Comments
 (0)