Skip to content

Commit a2f2190

Browse files
authored
Adjust codestyle for PHP 8.2 (#288)
1 parent 570a0a3 commit a2f2190

File tree

10 files changed

+11
-19
lines changed

10 files changed

+11
-19
lines changed

app/config/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919

2020
$_SERVER += $_ENV;
2121
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
22-
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
22+
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
2323
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

app/public/index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
66

7-
return function (array $context) {
8-
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
9-
};
7+
return fn (array $context): Kernel => new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

src/bundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ public function getConfigTreeBuilder(): TreeBuilder
4747
->arrayNode('ip_whitelist')
4848
->beforeNormalization()
4949
->ifArray()
50-
->then(static function (array $value): array {
51-
return iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($value)), false);
52-
})
50+
->then(static fn (array $value): array => iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($value)), false))
5351
->end()
5452
->defaultValue([])
5553
->prototype('scalar')->end()

src/bundle/Model/Persister/DoctrinePersisterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
class DoctrinePersisterFactory
1717
{
18-
private ManagerRegistry $managerRegistry;
18+
private readonly ManagerRegistry $managerRegistry;
1919

2020
public function __construct(
2121
ManagerRegistry|null $managerRegistry,

src/bundle/Security/Authentication/Exception/TwoFactorProviderNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TwoFactorProviderNotFoundException extends AuthenticationException
1414
public const MESSAGE_KEY = 'Two-factor provider not found.';
1515

1616
/** @psalm-suppress PropertyNotSetInConstructor */
17-
private string|null $provider;
17+
private string|null $provider = null;
1818

1919
public function getMessageKey(): string
2020
{

src/bundle/Security/Http/Authenticator/TwoFactorAuthenticator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TwoFactorAuthenticator implements AuthenticatorInterface, InteractiveAuthe
3939
{
4040
public const FLAG_2FA_COMPLETE = '2fa_complete';
4141

42-
private LoggerInterface $logger;
42+
private readonly LoggerInterface $logger;
4343

4444
public function __construct(
4545
private readonly TwoFactorFirewallConfig $twoFactorFirewallConfig,
@@ -72,9 +72,7 @@ public function authenticate(Request $request): Passport
7272
$this->dispatchTwoFactorAuthenticationEvent(TwoFactorAuthenticationEvents::ATTEMPT, $request, $currentToken);
7373

7474
$credentials = new TwoFactorCodeCredentials($currentToken, $this->twoFactorFirewallConfig->getAuthCodeFromRequest($request));
75-
$userLoader = static function () use ($currentToken): UserInterface {
76-
return $currentToken->getUser();
77-
};
75+
$userLoader = (static fn (): UserInterface => $currentToken->getUser());
7876
$userBadge = new UserBadge($currentToken->getUserIdentifier(), $userLoader);
7977
$passport = new Passport($userBadge, $credentials, []);
8078
if ($currentToken->hasAttribute(TwoFactorTokenInterface::ATTRIBUTE_NAME_USE_REMEMBER_ME)) {

src/bundle/Security/TwoFactor/Provider/TwoFactorProviderPreparationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TwoFactorProviderPreparationListener implements EventSubscriberInterface
3232
public const RESPONSE_LISTENER_PRIORITY = 1;
3333

3434
private TwoFactorTokenInterface|null $twoFactorToken = null;
35-
private LoggerInterface $logger;
35+
private readonly LoggerInterface $logger;
3636

3737
public function __construct(
3838
private readonly TwoFactorProviderRegistry $providerRegistry,

src/trusted-device/Security/TwoFactor/Trusted/JwtTokenEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class JwtTokenEncoder
2525
public const CLAIM_FIREWALL = 'fwl';
2626
public const CLAIM_VERSION = 'vsn';
2727

28-
private Clock $clock;
28+
private readonly Clock $clock;
2929

3030
public function __construct(private readonly Configuration $configuration, Clock|null $clock = null)
3131
{

src/trusted-device/Security/TwoFactor/Trusted/TrustedCookieResponseListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function onKernelResponse(ResponseEvent $event): void
5656
$this->getValidUntil(),
5757
$this->cookiePath,
5858
$domain,
59-
null === $this->cookieSecure ? $event->getRequest()->isSecure() : $this->cookieSecure,
59+
$this->cookieSecure ?? $event->getRequest()->isSecure(),
6060
true,
6161
false,
6262
$this->cookieSameSite,

src/trusted-device/Security/TwoFactor/Trusted/TrustedDeviceTokenStorage.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ public function hasUpdatedCookie(): bool
3939

4040
public function getCookieValue(): string|null
4141
{
42-
return implode(self::TOKEN_DELIMITER, array_map(static function (TrustedDeviceToken $token): string {
43-
return $token->serialize();
44-
}, $this->getTrustedTokenList()));
42+
return implode(self::TOKEN_DELIMITER, array_map(static fn (TrustedDeviceToken $token): string => $token->serialize(), $this->getTrustedTokenList()));
4543
}
4644

4745
public function hasTrustedToken(string $username, string $firewall, int $version): bool

0 commit comments

Comments
 (0)