Skip to content

Commit 0a33fc2

Browse files
bug #36806 RememberMeLogoutListener should depend on LogoutHandlerInterface (scheb)
This PR was merged into the 5.1-dev branch. Discussion ---------- RememberMeLogoutListener should depend on LogoutHandlerInterface | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT `RememberMeLogoutListener`, which was introduced together with the new authenticator security in Symfony 5.1, depends on `AbstractRememberMeServices`. This forces people to always extend from `AbstractRememberMeServices`, even when they're implementing the correct interface. I'd suggest to depend on the minimum interface, which is `LogoutHandlerInterface`, instead. Example of the type errors you'd get otherwise: ` Argument 1 passed to Symfony\Component\Security\Http\EventListener\RememberMeLogoutListener::__construct() must be an instance of Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices, instance of Scheb\TwoFactorBundle\Security\Authentication\RememberMe\RememberMeServicesDecorator given, called in var/cache/dev/Container3IpOCEd/getSecurity_Logout_Listener_RememberMe_MainService.php on line 22 ` with ```php class RememberMeServicesDecorator implements RememberMeServicesInterface, LogoutHandlerInterface [...] ``` Commits ------- 994700fbae Depend on LogoutHandlerInterface
2 parents 67b67aa + bcb710d commit 0a33fc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

EventListener/RememberMeLogoutListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1515
use Symfony\Component\Security\Core\Exception\LogicException;
1616
use Symfony\Component\Security\Http\Event\LogoutEvent;
17-
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
17+
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
1818

1919
/**
2020
* @author Wouter de Jong <[email protected]>
@@ -25,7 +25,7 @@ class RememberMeLogoutListener implements EventSubscriberInterface
2525
{
2626
private $rememberMeServices;
2727

28-
public function __construct(AbstractRememberMeServices $rememberMeServices)
28+
public function __construct(LogoutHandlerInterface $rememberMeServices)
2929
{
3030
$this->rememberMeServices = $rememberMeServices;
3131
}

0 commit comments

Comments
 (0)