Skip to content

Commit 84386ea

Browse files
committed
Fix for symfony/http-kernel 7.*
1 parent 5b56476 commit 84386ea

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

EventListener/EnforcePasswordChangeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function getSubscribedEvents(): array
6666

6767
public function onKernelRequest(RequestEvent $event): void
6868
{
69-
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
69+
if (true !== $event->isMainRequest()) {
7070
return;
7171
}
7272

spec/FSi/Bundle/AdminSecurityBundle/EventListener/EnforcePasswordChangeListenerSpec.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\HttpFoundation\RedirectResponse;
2121
use Symfony\Component\HttpFoundation\Request;
2222
use Symfony\Component\HttpKernel\Event\RequestEvent;
23-
use Symfony\Component\HttpKernel\HttpKernelInterface;
2423
use Symfony\Component\HttpKernel\KernelEvents;
2524
use Symfony\Component\Routing\RouterInterface;
2625
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
@@ -44,7 +43,7 @@ public function let(
4443
RouterInterface $router
4544
): void {
4645
$event->getRequest()->willReturn($request);
47-
$event->getRequestType()->willReturn(HttpKernelInterface::MASTER_REQUEST);
46+
$event->isMainRequest()->willReturn(true);
4847
$firewallMap->getFirewallConfig($request)->willReturn($firewallConfig);
4948
$firewallConfig->getName()->willReturn(self::CONFIGURED_FIREWALL);
5049
$authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY')->willReturn(true);
@@ -74,7 +73,7 @@ public function it_does_nothing_if_not_master_request(
7473
RequestEvent $event,
7574
TokenStorageInterface $tokenStorage
7675
): void {
77-
$event->getRequestType()->willReturn(HttpKernelInterface::SUB_REQUEST);
76+
$event->isMainRequest()->willReturn(false);
7877

7978
$tokenStorage->getToken()->shouldNotBeCalled();
8079
$event->setResponse(Argument::any())->shouldNotBeCalled();

0 commit comments

Comments
 (0)