Skip to content

Commit 541dc0a

Browse files
Merge branch '5.4' into 6.3
* 5.4: Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2 parents 79cd095 + 274a6ae commit 541dc0a

File tree

58 files changed

+1868
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1868
-59
lines changed

AccessMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AccessMap implements AccessMapInterface
3030
*
3131
* @return void
3232
*/
33-
public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], string $channel = null)
33+
public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], ?string $channel = null)
3434
{
3535
$this->map[] = [$requestMatcher, $attributes, $channel];
3636
}

Authentication/AuthenticatorManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthent
5858
/**
5959
* @param iterable<mixed, AuthenticatorInterface> $authenticators
6060
*/
61-
public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = [])
61+
public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, ?LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = [])
6262
{
6363
$this->authenticators = $authenticators;
6464
$this->tokenStorage = $tokenStorage;

Authentication/DefaultAuthenticationFailureHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
4343
'failure_path_parameter' => '_failure_path',
4444
];
4545

46-
public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options = [], LoggerInterface $logger = null)
46+
public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options = [], ?LoggerInterface $logger = null)
4747
{
4848
$this->httpKernel = $httpKernel;
4949
$this->httpUtils = $httpUtils;

Authentication/DefaultAuthenticationSuccessHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
4545
/**
4646
* @param array $options Options for processing a successful authentication attempt
4747
*/
48-
public function __construct(HttpUtils $httpUtils, array $options = [], LoggerInterface $logger = null)
48+
public function __construct(HttpUtils $httpUtils, array $options = [], ?LoggerInterface $logger = null)
4949
{
5050
$this->httpUtils = $httpUtils;
5151
$this->logger = $logger;

Authenticator/AbstractLoginFormAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
6060
* Override to control what happens when the user hits a secure page
6161
* but isn't logged in yet.
6262
*/
63-
public function start(Request $request, AuthenticationException $authException = null): Response
63+
public function start(Request $request, ?AuthenticationException $authException = null): Response
6464
{
6565
$url = $this->getLoginUrl($request);
6666

Authenticator/AbstractPreAuthenticatedAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class AbstractPreAuthenticatedAuthenticator implements InteractiveAuthe
4141
private string $firewallName;
4242
private ?LoggerInterface $logger;
4343

44-
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, LoggerInterface $logger = null)
44+
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, ?LoggerInterface $logger = null)
4545
{
4646
$this->userProvider = $userProvider;
4747
$this->tokenStorage = $tokenStorage;

Authenticator/AccessTokenAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function setTranslator(?TranslatorInterface $translator)
106106
/**
107107
* @see https://datatracker.ietf.org/doc/html/rfc6750#section-3
108108
*/
109-
private function getAuthenticateHeader(string $errorDescription = null): string
109+
private function getAuthenticateHeader(?string $errorDescription = null): string
110110
{
111111
$data = [
112112
'realm' => $this->realm,

Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
7878
return $this->authenticator->onAuthenticationFailure($request, $exception);
7979
}
8080

81-
public function start(Request $request, AuthenticationException $authException = null): Response
81+
public function start(Request $request, ?AuthenticationException $authException = null): Response
8282
{
8383
if (!$this->authenticator instanceof AuthenticationEntryPointInterface) {
8484
throw new NotAnEntryPointException();

Authenticator/FormLoginAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function setHttpKernel(HttpKernelInterface $httpKernel): void
143143
$this->httpKernel = $httpKernel;
144144
}
145145

146-
public function start(Request $request, AuthenticationException $authException = null): Response
146+
public function start(Request $request, ?AuthenticationException $authException = null): Response
147147
{
148148
if (!$this->options['use_forward']) {
149149
return parent::start($request, $authException);

Authenticator/HttpBasicAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ class HttpBasicAuthenticator implements AuthenticatorInterface, AuthenticationEn
3737
private UserProviderInterface $userProvider;
3838
private ?LoggerInterface $logger;
3939

40-
public function __construct(string $realmName, UserProviderInterface $userProvider, LoggerInterface $logger = null)
40+
public function __construct(string $realmName, UserProviderInterface $userProvider, ?LoggerInterface $logger = null)
4141
{
4242
$this->realmName = $realmName;
4343
$this->userProvider = $userProvider;
4444
$this->logger = $logger;
4545
}
4646

47-
public function start(Request $request, AuthenticationException $authException = null): Response
47+
public function start(Request $request, ?AuthenticationException $authException = null): Response
4848
{
4949
$response = new Response();
5050
$response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));

Authenticator/JsonLoginAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class JsonLoginAuthenticator implements InteractiveAuthenticatorInterface
5252
private ?AuthenticationFailureHandlerInterface $failureHandler;
5353
private ?TranslatorInterface $translator = null;
5454

55-
public function __construct(HttpUtils $httpUtils, UserProviderInterface $userProvider, AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler = null, array $options = [], PropertyAccessorInterface $propertyAccessor = null)
55+
public function __construct(HttpUtils $httpUtils, UserProviderInterface $userProvider, ?AuthenticationSuccessHandlerInterface $successHandler = null, ?AuthenticationFailureHandlerInterface $failureHandler = null, array $options = [], ?PropertyAccessorInterface $propertyAccessor = null)
5656
{
5757
$this->options = array_merge(['username_path' => 'username', 'password_path' => 'password'], $options);
5858
$this->httpUtils = $httpUtils;

Authenticator/Passport/Badge/PasswordUpgradeBadge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PasswordUpgradeBadge implements BadgeInterface
3232
* @param string $plaintextPassword The presented password, used in the rehash
3333
* @param PasswordUpgraderInterface|null $passwordUpgrader The password upgrader, defaults to the UserProvider if null
3434
*/
35-
public function __construct(#[\SensitiveParameter] string $plaintextPassword, PasswordUpgraderInterface $passwordUpgrader = null)
35+
public function __construct(#[\SensitiveParameter] string $plaintextPassword, ?PasswordUpgraderInterface $passwordUpgrader = null)
3636
{
3737
$this->plaintextPassword = $plaintextPassword;
3838
$this->passwordUpgrader = $passwordUpgrader;

Authenticator/Passport/Badge/UserBadge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class UserBadge implements BadgeInterface
4949
* is thrown). If this is not set, the default user provider will be used with
5050
* $userIdentifier as username.
5151
*/
52-
public function __construct(string $userIdentifier, callable $userLoader = null, array $attributes = null)
52+
public function __construct(string $userIdentifier, ?callable $userLoader = null, ?array $attributes = null)
5353
{
5454
if (\strlen($userIdentifier) > self::MAX_USERNAME_LENGTH) {
5555
throw new BadCredentialsException('Username too long.');

Authenticator/RememberMeAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class RememberMeAuthenticator implements InteractiveAuthenticatorInterface
4949
private string $cookieName;
5050
private ?LoggerInterface $logger;
5151

52-
public function __construct(RememberMeHandlerInterface $rememberMeHandler, #[\SensitiveParameter] string $secret, TokenStorageInterface $tokenStorage, string $cookieName, LoggerInterface $logger = null)
52+
public function __construct(RememberMeHandlerInterface $rememberMeHandler, #[\SensitiveParameter] string $secret, TokenStorageInterface $tokenStorage, string $cookieName, ?LoggerInterface $logger = null)
5353
{
5454
$this->rememberMeHandler = $rememberMeHandler;
5555
$this->secret = $secret;

Authenticator/RemoteUserAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RemoteUserAuthenticator extends AbstractPreAuthenticatedAuthenticator
3232
{
3333
private string $userKey;
3434

35-
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'REMOTE_USER', LoggerInterface $logger = null)
35+
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'REMOTE_USER', ?LoggerInterface $logger = null)
3636
{
3737
parent::__construct($userProvider, $tokenStorage, $firewallName, $logger);
3838

Authenticator/X509Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class X509Authenticator extends AbstractPreAuthenticatedAuthenticator
3232
private string $credentialsKey;
3333
private string $credentialUserIdentifier;
3434

35-
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'SSL_CLIENT_S_DN_Email', string $credentialsKey = 'SSL_CLIENT_S_DN', LoggerInterface $logger = null, string $credentialUserIdentifier = 'emailAddress')
35+
public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'SSL_CLIENT_S_DN_Email', string $credentialsKey = 'SSL_CLIENT_S_DN', ?LoggerInterface $logger = null, string $credentialUserIdentifier = 'emailAddress')
3636
{
3737
parent::__construct($userProvider, $tokenStorage, $firewallName, $logger);
3838

EntryPoint/AuthenticationEntryPointInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ interface AuthenticationEntryPointInterface
4242
*
4343
* @return Response
4444
*/
45-
public function start(Request $request, AuthenticationException $authException = null);
45+
public function start(Request $request, ?AuthenticationException $authException = null);
4646
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\EntryPoint;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\Security\Core\Exception\AuthenticationException;
17+
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
18+
19+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use the new security system with "%s" instead.', BasicAuthenticationEntryPoint::class, HttpBasicAuthenticator::class);
20+
21+
/**
22+
* BasicAuthenticationEntryPoint starts an HTTP Basic authentication.
23+
*
24+
* @author Fabien Potencier <[email protected]>
25+
*
26+
* @deprecated since Symfony 5.4
27+
*/
28+
class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface
29+
{
30+
private $realmName;
31+
32+
public function __construct(string $realmName)
33+
{
34+
$this->realmName = $realmName;
35+
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function start(Request $request, ?AuthenticationException $authException = null)
41+
{
42+
$response = new Response();
43+
$response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));
44+
$response->setStatusCode(401);
45+
46+
return $response;
47+
}
48+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\EntryPoint;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\HttpKernel\HttpKernelInterface;
16+
use Symfony\Component\Security\Core\Exception\AuthenticationException;
17+
use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator;
18+
use Symfony\Component\Security\Http\HttpUtils;
19+
20+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use the new security system with "%s" instead.', FormAuthenticationEntryPoint::class, FormLoginAuthenticator::class);
21+
22+
/**
23+
* FormAuthenticationEntryPoint starts an authentication via a login form.
24+
*
25+
* @author Fabien Potencier <[email protected]>
26+
*
27+
* @deprecated since Symfony 5.4
28+
*/
29+
class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
30+
{
31+
private $loginPath;
32+
private $useForward;
33+
private $httpKernel;
34+
private $httpUtils;
35+
36+
/**
37+
* @param string $loginPath The path to the login form
38+
* @param bool $useForward Whether to forward or redirect to the login form
39+
*/
40+
public function __construct(HttpKernelInterface $kernel, HttpUtils $httpUtils, string $loginPath, bool $useForward = false)
41+
{
42+
$this->httpKernel = $kernel;
43+
$this->httpUtils = $httpUtils;
44+
$this->loginPath = $loginPath;
45+
$this->useForward = $useForward;
46+
}
47+
48+
/**
49+
* {@inheritdoc}
50+
*/
51+
public function start(Request $request, ?AuthenticationException $authException = null)
52+
{
53+
if ($this->useForward) {
54+
$subRequest = $this->httpUtils->createRequest($request, $this->loginPath);
55+
56+
$response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
57+
if (200 === $response->getStatusCode()) {
58+
$response->setStatusCode(401);
59+
}
60+
61+
return $response;
62+
}
63+
64+
return $this->httpUtils->createRedirectResponse($request, $this->loginPath);
65+
}
66+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\EntryPoint;
13+
14+
use Symfony\Component\HttpFoundation\RedirectResponse;
15+
use Symfony\Component\HttpFoundation\Request;
16+
use Symfony\Component\Security\Core\Exception\AuthenticationException;
17+
use Symfony\Component\Security\Http\Firewall\ChannelListener;
18+
19+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" directly (and optionally configure the HTTP(s) ports there).', RetryAuthenticationEntryPoint::class, ChannelListener::class);
20+
21+
/**
22+
* RetryAuthenticationEntryPoint redirects URL based on the configured scheme.
23+
*
24+
* This entry point is not intended to work with HTTP post requests.
25+
*
26+
* @author Fabien Potencier <[email protected]>
27+
*
28+
* @deprecated since Symfony 5.4
29+
*/
30+
class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface
31+
{
32+
private $httpPort;
33+
private $httpsPort;
34+
35+
public function __construct(int $httpPort = 80, int $httpsPort = 443)
36+
{
37+
$this->httpPort = $httpPort;
38+
$this->httpsPort = $httpsPort;
39+
}
40+
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
public function start(Request $request, ?AuthenticationException $authException = null)
45+
{
46+
$scheme = $request->isSecure() ? 'http' : 'https';
47+
if ('http' === $scheme && 80 != $this->httpPort) {
48+
$port = ':'.$this->httpPort;
49+
} elseif ('https' === $scheme && 443 != $this->httpsPort) {
50+
$port = ':'.$this->httpsPort;
51+
} else {
52+
$port = '';
53+
}
54+
55+
$qs = $request->getQueryString();
56+
if (null !== $qs) {
57+
$qs = '?'.$qs;
58+
}
59+
60+
$url = $scheme.'://'.$request->getHost().$port.$request->getBaseUrl().$request->getPathInfo().$qs;
61+
62+
return new RedirectResponse($url, 301);
63+
}
64+
}

Event/LoginFailureEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class LoginFailureEvent extends Event
3636
private string $firewallName;
3737
private ?Passport $passport;
3838

39-
public function __construct(AuthenticationException $exception, AuthenticatorInterface $authenticator, Request $request, ?Response $response, string $firewallName, Passport $passport = null)
39+
public function __construct(AuthenticationException $exception, AuthenticatorInterface $authenticator, Request $request, ?Response $response, string $firewallName, ?Passport $passport = null)
4040
{
4141
$this->exception = $exception;
4242
$this->authenticator = $authenticator;

Event/LoginSuccessEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class LoginSuccessEvent extends Event
4040
private ?Response $response;
4141
private string $firewallName;
4242

43-
public function __construct(AuthenticatorInterface $authenticator, Passport $passport, TokenInterface $authenticatedToken, Request $request, ?Response $response, string $firewallName, TokenInterface $previousToken = null)
43+
public function __construct(AuthenticatorInterface $authenticator, Passport $passport, TokenInterface $authenticatedToken, Request $request, ?Response $response, string $firewallName, ?TokenInterface $previousToken = null)
4444
{
4545
$this->authenticator = $authenticator;
4646
$this->passport = $passport;

Event/SwitchUserEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class SwitchUserEvent extends Event
2727
private UserInterface $targetUser;
2828
private ?TokenInterface $token;
2929

30-
public function __construct(Request $request, UserInterface $targetUser, TokenInterface $token = null)
30+
public function __construct(Request $request, UserInterface $targetUser, ?TokenInterface $token = null)
3131
{
3232
$this->request = $request;
3333
$this->targetUser = $targetUser;

EventListener/CheckRememberMeConditionsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CheckRememberMeConditionsListener implements EventSubscriberInterface
3838
private array $options;
3939
private ?LoggerInterface $logger;
4040

41-
public function __construct(array $options = [], LoggerInterface $logger = null)
41+
public function __construct(array $options = [], ?LoggerInterface $logger = null)
4242
{
4343
$this->options = $options + ['always_remember_me' => false, 'remember_me_parameter' => '_remember_me'];
4444
$this->logger = $logger;

EventListener/RememberMeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class RememberMeListener implements EventSubscriberInterface
3737
private RememberMeHandlerInterface $rememberMeHandler;
3838
private ?LoggerInterface $logger;
3939

40-
public function __construct(RememberMeHandlerInterface $rememberMeHandler, LoggerInterface $logger = null)
40+
public function __construct(RememberMeHandlerInterface $rememberMeHandler, ?LoggerInterface $logger = null)
4141
{
4242
$this->rememberMeHandler = $rememberMeHandler;
4343
$this->logger = $logger;

0 commit comments

Comments
 (0)