vendor/symfony/security-http/EventListener/SessionLogoutListener.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Security\Http\EventListener;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\Security\Http\Event\LogoutEvent;
  13. /**
  14.  * Handler for clearing invalidating the current session.
  15.  *
  16.  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  17.  *
  18.  * @final
  19.  */
  20. class SessionLogoutListener implements EventSubscriberInterface
  21. {
  22.     public function onLogout(LogoutEvent $event): void
  23.     {
  24.         $event->getRequest()->getSession()->invalidate();
  25.     }
  26.     public static function getSubscribedEvents(): array
  27.     {
  28.         return [
  29.             LogoutEvent::class => 'onLogout',
  30.         ];
  31.     }
  32. }