From 50b7a993fbb7f588e73223916dd1b00adda1231a Mon Sep 17 00:00:00 2001 From: Christian Scheb Date: Sat, 30 Oct 2021 19:18:03 +0200 Subject: [PATCH 1/2] Deprecate FirewallMapInterface::getListeners and FirewallContext::getListeners --- .../Bundle/SecurityBundle/CHANGELOG.md | 1 + .../DependencyInjection/SecurityExtension.php | 8 +-- .../Resources/config/security.php | 2 - .../Security/FirewallContext.php | 63 +++++++++++++++++-- .../SecurityBundle/Security/FirewallMap.php | 32 +++++++++- .../Security/LazyFirewallContext.php | 27 ++++++-- .../CompleteConfigurationTest.php | 6 +- .../Tests/Security/FirewallContextTest.php | 10 +-- .../Tests/Security/FirewallMapTest.php | 16 +++-- .../Component/Security/Http/CHANGELOG.md | 1 + .../Component/Security/Http/Firewall.php | 2 +- .../Component/Security/Http/FirewallMap.php | 49 ++++++++++++++- .../Security/Http/FirewallMapInterface.php | 5 ++ .../Security/Http/Tests/FirewallMapTest.php | 6 +- .../Security/Http/Tests/FirewallTest.php | 6 ++ 15 files changed, 200 insertions(+), 34 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md index 4cb8093f88daf..05a9b793a95d3 100644 --- a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md @@ -18,6 +18,7 @@ CHANGELOG * Display the roles of the logged-in user in the Web Debug Toolbar * Add the `security.access_decision_manager.strategy_service` option * Deprecate not configuring explicitly a provider for custom_authenticators when there is more than one registered provider + * Deprecate `FirewallContext::getListeners`, use `FirewallContext::getFirewallListeners` and `FirewallContext::getExceptionListener` instead 5.3 --- diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 9774c219f1cb3..8ca6037fd1796 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -320,7 +320,7 @@ private function createFirewalls(array $config, ContainerBuilder $container) $configId = 'security.firewall.map.config.'.$name; - [$matcher, $listeners, $exceptionListener, $logoutListener] = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId); + [$matcher, $listeners, $exceptionListener] = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId); $contextId = 'security.firewall.map.context.'.$name; $isLazy = !$firewall['stateless'] && (!empty($firewall['anonymous']['lazy']) || $firewall['lazy']); @@ -329,8 +329,7 @@ private function createFirewalls(array $config, ContainerBuilder $container) $context ->replaceArgument(0, new IteratorArgument($listeners)) ->replaceArgument(1, $exceptionListener) - ->replaceArgument(2, $logoutListener) - ->replaceArgument(3, new Reference($configId)) + ->replaceArgument(2, new Reference($configId)) ; $contextRefs[$contextId] = new Reference($contextId); @@ -450,6 +449,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $ 'csrf_token_id' => $firewall['logout']['csrf_token_id'], 'logout_path' => $firewall['logout']['path'], ]); + $listeners[] = new Reference($logoutListenerId); // add default logout listener if (isset($firewall['logout']['success_handler'])) { @@ -599,7 +599,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $ $config->replaceArgument(10, $listenerKeys); $config->replaceArgument(11, $firewall['switch_user'] ?? null); - return [$matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null]; + return [$matcher, $listeners, $exceptionListener]; } private function createContextListener(ContainerBuilder $container, string $contextKey, ?string $firewallEventDispatcherId) diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php index 9c44adf0338cb..6e7d6ed0aa0b0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.php @@ -196,7 +196,6 @@ ->args([ [], service('security.exception_listener'), - abstract_arg('LogoutListener'), abstract_arg('FirewallConfig'), ]) @@ -205,7 +204,6 @@ ->args([ [], service('security.exception_listener'), - abstract_arg('LogoutListener'), abstract_arg('FirewallConfig'), service('security.untracked_token_storage'), ]) diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php index 4ebc9c7de0dc7..934fa3ccd9560 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php @@ -24,17 +24,22 @@ class FirewallContext { private $listeners; private $exceptionListener; - private $logoutListener; private $config; + private $logoutListener = null; /** * @param iterable $listeners */ - public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null, FirewallConfig $config = null) + public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, /*FirewallConfig*/ $config = null) { + if ($config instanceof LogoutListener) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Passing the LogoutListener as third argument is deprecated, add it to $listeners instead.', __METHOD__); + $this->logoutListener = $config; + $config = \func_num_args() > 3 ? func_get_arg(3) : null; + } + $this->listeners = $listeners; $this->exceptionListener = $exceptionListener; - $this->logoutListener = $logoutListener; $this->config = $config; } @@ -45,19 +50,65 @@ public function getConfig() /** * @return iterable + * + * @deprecated since Symfony 5.4, use "getFirewallListeners()" instead */ public function getListeners(): iterable { - return $this->listeners; + if (0 === \func_num_args() || func_get_arg(0)) { + trigger_deprecation('symfony/security-bundle', '5.4', 'The %s() method is deprecated, use getFirewallListeners() instead.', __METHOD__); + } + + // Ensure LogoutListener is not included + foreach ($this->listeners as $listener) { + if (!($listener instanceof LogoutListener)) { + yield $listener; + } + } + } + + /** + * @return iterable + */ + public function getFirewallListeners(): iterable + { + $containedLogoutListener = false; + foreach ($this->listeners as $listener) { + yield $listener; + $containedLogoutListener |= $listener instanceof LogoutListener; + } + + // Ensure the LogoutListener is contained + if (null !== $this->logoutListener && !$containedLogoutListener) { + yield $this->logoutListener; + } } - public function getExceptionListener() + public function getExceptionListener(): ?ExceptionListener { return $this->exceptionListener; } + /** + * @deprecated since Symfony 5.4, use "getFirewallListeners()" instead + */ public function getLogoutListener() { - return $this->logoutListener; + if (0 === \func_num_args() || func_get_arg(0)) { + trigger_deprecation('symfony/security-bundle', '5.4', 'The %s() method is deprecated, use getFirewallListeners() instead.', __METHOD__); + } + + if (null !== $this->logoutListener) { + return $this->logoutListener; + } + + // Return LogoutListener from listeners list + foreach ($this->listeners as $listener) { + if ($listener instanceof LogoutListener) { + return $listener; + } + } + + return null; } } diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php index 06cbc64d18c6b..ed75dbba94731 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php @@ -13,6 +13,7 @@ use Psr\Container\ContainerInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; use Symfony\Component\Security\Http\FirewallMapInterface; /** @@ -33,15 +34,44 @@ public function __construct(ContainerInterface $container, iterable $map) $this->map = $map; } + /** + * {@inheritdoc} + */ public function getListeners(Request $request) { + if (2 > \func_num_args() || func_get_arg(1)) { + trigger_deprecation('symfony/security-bundle', '5.4', 'The %s() method is deprecated, use getFirewallListeners() or "getExceptionListener()" instead.', __METHOD__); + } + $context = $this->getFirewallContext($request); if (null === $context) { return [[], null, null]; } - return [$context->getListeners(), $context->getExceptionListener(), $context->getLogoutListener()]; + return [$context->getListeners(false), $context->getExceptionListener(), $context->getLogoutListener(false)]; + } + + public function getFirewallListeners(Request $request): iterable + { + $context = $this->getFirewallContext($request); + + if (null === $context) { + return []; + } + + return $context->getFirewallListeners(); + } + + public function getExceptionListener(Request $request): ?ExceptionListener + { + $context = $this->getFirewallContext($request); + + if (null === $context) { + return null; + } + + return $context->getExceptionListener(); } /** diff --git a/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php index 9d8396a8830c9..52696c6f13c5e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php @@ -16,7 +16,6 @@ use Symfony\Component\Security\Http\Event\LazyResponseEvent; use Symfony\Component\Security\Http\Firewall\ExceptionListener; use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; -use Symfony\Component\Security\Http\Firewall\LogoutListener; /** * Lazily calls authentication listeners when actually required by the access listener. @@ -27,13 +26,33 @@ class LazyFirewallContext extends FirewallContext { private $tokenStorage; - public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener, ?LogoutListener $logoutListener, ?FirewallConfig $config, TokenStorage $tokenStorage) + /** + * @param iterable $listeners + */ + public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener, /*?FirewallConfig*/ $config, /*TokenStorage*/ $tokenStorage) { - parent::__construct($listeners, $exceptionListener, $logoutListener, $config); + $arguments = \func_get_args(); + + if (\count($arguments) > 4 && $arguments[4] instanceof TokenStorage) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Passing the LogoutListener as third argument is deprecated, add it to $listeners instead.', __METHOD__); + + $logoutListener = $arguments[2]; + $config = $arguments[3]; + $this->tokenStorage = $arguments[4]; + + parent::__construct($listeners, $exceptionListener, $logoutListener, $config); + + return; + } + + parent::__construct($listeners, $exceptionListener, $config); $this->tokenStorage = $tokenStorage; } + /** + * {@inheritdoc} + */ public function getListeners(): iterable { return [$this]; @@ -45,7 +64,7 @@ public function __invoke(RequestEvent $event) $request = $event->getRequest(); $lazy = $request->isMethodCacheable(); - foreach (parent::getListeners() as $listener) { + foreach (parent::getListeners(false) as $listener) { if (!$lazy || !$listener instanceof FirewallListenerInterface) { $listeners[] = $listener; $lazy = $lazy && $listener instanceof FirewallListenerInterface; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index ae32d474c7cf6..186b757f7feba 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -120,7 +120,7 @@ public function testFirewalls() $arguments = $contextDef->getArguments(); $listeners[] = array_map('strval', $arguments[0]->getValues()); - $configDef = $container->getDefinition((string) $arguments[3]); + $configDef = $container->getDefinition((string) $arguments[2]); $configs[] = array_values($configDef->getArguments()); } @@ -208,6 +208,7 @@ public function testFirewalls() 'security.channel_listener', 'security.firewall.authenticator.secure', 'security.authentication.switchuser_listener.secure', + 'security.logout_listener.secure', 'security.access_listener', ], [ @@ -241,7 +242,7 @@ public function testLegacyFirewalls() $arguments = $contextDef->getArguments(); $listeners[] = array_map('strval', $arguments[0]->getValues()); - $configDef = $container->getDefinition((string) $arguments[3]); + $configDef = $container->getDefinition((string) $arguments[2]); $configs[] = array_values($configDef->getArguments()); } @@ -337,6 +338,7 @@ public function testLegacyFirewalls() 'security.authentication.listener.rememberme.secure', 'security.authentication.listener.anonymous.secure', 'security.authentication.switchuser_listener.secure', + 'security.logout_listener.secure', 'security.access_listener', ], [ diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php index c76783b7e08ad..7aeccccecf152 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php @@ -24,13 +24,15 @@ public function testGetters() $config = new FirewallConfig('main', 'user_checker', 'request_matcher'); $exceptionListener = $this->getExceptionListenerMock(); $logoutListener = $this->getLogoutListenerMock(); - $listeners = [function () {}]; + $listeners = [function () {}, $logoutListener]; + $listenersMinusLogoutListener = [function () {}]; - $context = new FirewallContext($listeners, $exceptionListener, $logoutListener, $config); + $context = new FirewallContext($listeners, $exceptionListener, $config); - $this->assertEquals($listeners, $context->getListeners()); + $this->assertEquals($listenersMinusLogoutListener, iterator_to_array($context->getListeners(false))); $this->assertEquals($exceptionListener, $context->getExceptionListener()); - $this->assertEquals($logoutListener, $context->getLogoutListener()); + $this->assertEquals($logoutListener, $context->getLogoutListener(false)); + $this->assertEquals($listeners, iterator_to_array($context->getFirewallListeners())); $this->assertEquals($config, $context->getConfig()); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php index d174e13b5cff8..09395bf341bab 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php @@ -35,7 +35,7 @@ public function testGetListenersWithEmptyMap() $firewallMap = new FirewallMap($container, $map); - $this->assertEquals([[], null, null], $firewallMap->getListeners($request)); + $this->assertEquals([], $firewallMap->getFirewallListeners($request)); $this->assertNull($firewallMap->getFirewallConfig($request)); $this->assertFalse($request->attributes->has(self::ATTRIBUTE_FIREWALL_CONTEXT)); } @@ -51,11 +51,14 @@ public function testGetListenersWithInvalidParameter() $firewallMap = new FirewallMap($container, $map); - $this->assertEquals([[], null, null], $firewallMap->getListeners($request)); + $this->assertEquals([], $firewallMap->getFirewallListeners($request)); $this->assertNull($firewallMap->getFirewallConfig($request)); $this->assertFalse($request->attributes->has(self::ATTRIBUTE_FIREWALL_CONTEXT)); } + /** + * @group legacy + */ public function testGetListeners() { $request = new Request(); @@ -67,9 +70,10 @@ public function testGetListeners() $listener = function () {}; $firewallContext->expects($this->once())->method('getListeners')->willReturn([$listener]); + $firewallContext->expects($this->once())->method('getFirewallListeners')->willReturn([$listener]); $exceptionListener = $this->createMock(ExceptionListener::class); - $firewallContext->expects($this->once())->method('getExceptionListener')->willReturn($exceptionListener); + $firewallContext->expects($this->exactly(2))->method('getExceptionListener')->willReturn($exceptionListener); $logoutListener = $this->createMock(LogoutListener::class); $firewallContext->expects($this->once())->method('getLogoutListener')->willReturn($logoutListener); @@ -81,11 +85,13 @@ public function testGetListeners() ->willReturn(true); $container = $this->createMock(Container::class); - $container->expects($this->exactly(2))->method('get')->willReturn($firewallContext); + $container->expects($this->exactly(4))->method('get')->willReturn($firewallContext); $firewallMap = new FirewallMap($container, ['security.firewall.map.context.foo' => $matcher]); - $this->assertEquals([[$listener], $exceptionListener, $logoutListener], $firewallMap->getListeners($request)); + $this->assertEquals([[$listener], $exceptionListener, $logoutListener], $firewallMap->getListeners($request, false)); + $this->assertEquals([$listener], $firewallMap->getFirewallListeners($request)); + $this->assertEquals($exceptionListener, $firewallMap->getExceptionListener($request)); $this->assertEquals($firewallConfig, $firewallMap->getFirewallConfig($request)); $this->assertEquals('security.firewall.map.context.foo', $request->attributes->get(self::ATTRIBUTE_FIREWALL_CONTEXT)); } diff --git a/src/Symfony/Component/Security/Http/CHANGELOG.md b/src/Symfony/Component/Security/Http/CHANGELOG.md index 10710157a5b40..9f6fef4045498 100644 --- a/src/Symfony/Component/Security/Http/CHANGELOG.md +++ b/src/Symfony/Component/Security/Http/CHANGELOG.md @@ -16,6 +16,7 @@ CHANGELOG * Deprecate `CookieClearingLogoutHandler`, `SessionLogoutHandler` and `CsrfTokenClearingLogoutHandler`. Use `CookieClearingLogoutListener`, `SessionLogoutListener` and `CsrfTokenClearingLogoutListener` instead * Deprecate `PassportInterface`, `UserPassportInterface` and `PassportTrait`, use `Passport` instead + * Deprecate `FirewallMapInterface::getListeners`, use `FirewallMapInterface::getFirewallListeners` and `FirewallMapInterface::getExceptionListener` instead 5.3 --- diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index be758a63ca44e..069eddbffd673 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -54,7 +54,7 @@ public function onKernelRequest(RequestEvent $event) } // register listeners for this firewall - $listeners = $this->map->getListeners($event->getRequest()); + $listeners = $this->map->getListeners($event->getRequest(), false); $authenticationListeners = $listeners[0]; $exceptionListener = $listeners[1]; diff --git a/src/Symfony/Component/Security/Http/FirewallMap.php b/src/Symfony/Component/Security/Http/FirewallMap.php index cc9d853e96b42..86385e6a8dc24 100644 --- a/src/Symfony/Component/Security/Http/FirewallMap.php +++ b/src/Symfony/Component/Security/Http/FirewallMap.php @@ -34,7 +34,26 @@ class FirewallMap implements FirewallMapInterface */ public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = [], ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null) { - $this->map[] = [$requestMatcher, $listeners, $exceptionListener, $logoutListener]; + $allListeners = $listeners; + + if (null !== $logoutListener) { + trigger_deprecation('symfony/security', '5.4', 'Passing the LogoutListener as forth argument is deprecated, add it to $listeners instead.', __METHOD__); + + // Ensure LogoutListener is contained in all listeners list + if (!\in_array($logoutListener, $allListeners)) { + $allListeners[] = $logoutListener; + } + } else { + // Take LogoutListeners from all listeners list + foreach ($listeners as $listener) { + if ($listener instanceof LogoutListener) { + $logoutListener = $listener; + break; + } + } + } + + $this->map[] = [$requestMatcher, $allListeners, $exceptionListener, $listeners, $logoutListener]; } /** @@ -42,12 +61,38 @@ public function add(RequestMatcherInterface $requestMatcher = null, array $liste */ public function getListeners(Request $request) { + if (2 > \func_num_args() || func_get_arg(1)) { + trigger_deprecation('symfony/security', '5.4', 'The %s() method is deprecated, use getFirewallListeners() or "getExceptionListener()" instead.', __METHOD__); + } + foreach ($this->map as $elements) { if (null === $elements[0] || $elements[0]->matches($request)) { - return [$elements[1], $elements[2], $elements[3]]; + return [$elements[3], $elements[2], $elements[4]]; } } return [[], null, null]; } + + public function getFirewallListeners(Request $request): iterable + { + foreach ($this->map as $elements) { + if (null === $elements[0] || $elements[0]->matches($request)) { + return $elements[1]; + } + } + + return []; + } + + public function getExceptionListener(Request $request): ?ExceptionListener + { + foreach ($this->map as $elements) { + if (null === $elements[0] || $elements[0]->matches($request)) { + return $elements[2]; + } + } + + return null; + } } diff --git a/src/Symfony/Component/Security/Http/FirewallMapInterface.php b/src/Symfony/Component/Security/Http/FirewallMapInterface.php index 480ea8ad6b4f1..016476e57110c 100644 --- a/src/Symfony/Component/Security/Http/FirewallMapInterface.php +++ b/src/Symfony/Component/Security/Http/FirewallMapInterface.php @@ -18,6 +18,9 @@ /** * This interface must be implemented by firewall maps. * + * @method iterable getFirewallListeners(Request $request) returns the sorted list of firewall listeners + * @method ExceptionListener|null getExceptionListener(Request $request) returns the firewall's exception listener + * * @author Johannes M. Schmitt */ interface FirewallMapInterface @@ -36,6 +39,8 @@ interface FirewallMapInterface * must be null. * * @return array{iterable, ExceptionListener, LogoutListener} + * + * @deprecated since Symfony 5.4, use "getFirewallListeners()" instead */ public function getListeners(Request $request); } diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php index bc3a1a0538241..28eb171485052 100644 --- a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php +++ b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php @@ -55,7 +55,7 @@ public function testGetListeners() $map->add($tooLateMatcher, [function () {}]); - [$listeners, $exception] = $map->getListeners($request); + [$listeners, $exception] = $map->getListeners($request, false); $this->assertEquals([$theListener], $listeners); $this->assertEquals($theException, $exception); @@ -90,7 +90,7 @@ public function testGetListenersWithAnEntryHavingNoRequestMatcher() $map->add($tooLateMatcher, [function () {}]); - [$listeners, $exception] = $map->getListeners($request); + [$listeners, $exception] = $map->getListeners($request, false); $this->assertEquals([$theListener], $listeners); $this->assertEquals($theException, $exception); @@ -112,7 +112,7 @@ public function testGetListenersWithNoMatchingEntry() $map->add($notMatchingMatcher, [function () {}]); - [$listeners, $exception] = $map->getListeners($request); + [$listeners, $exception] = $map->getListeners($request, false); $this->assertEquals([], $listeners); $this->assertNull($exception); diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php index f9417d237433c..61a0af1869f59 100644 --- a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php +++ b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php @@ -23,6 +23,9 @@ class FirewallTest extends TestCase { + /** + * @group legacy + */ public function testOnKernelRequestRegistersExceptionListener() { $dispatcher = $this->createMock(EventDispatcherInterface::class); @@ -50,6 +53,9 @@ public function testOnKernelRequestRegistersExceptionListener() $firewall->onKernelRequest($event); } + /** + * @group legacy + */ public function testOnKernelRequestStopsWhenThereIsAResponse() { $called = []; From a42a3677171bdd0fa4f6e8b75941ff6d402b2dc3 Mon Sep 17 00:00:00 2001 From: Christian Scheb Date: Mon, 15 Nov 2021 21:32:31 +0100 Subject: [PATCH 2/2] Fix psalm type annotation --- src/Symfony/Component/Security/Http/FirewallMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/FirewallMap.php b/src/Symfony/Component/Security/Http/FirewallMap.php index 86385e6a8dc24..05bac972a2560 100644 --- a/src/Symfony/Component/Security/Http/FirewallMap.php +++ b/src/Symfony/Component/Security/Http/FirewallMap.php @@ -25,7 +25,7 @@ class FirewallMap implements FirewallMapInterface { /** - * @var list, ExceptionListener|null, LogoutListener|null}> + * @var list, ExceptionListener|null, list, LogoutListener|null}> */ private $map = [];