Skip to content

Commit

Permalink
Fixes Symfony 3.4 compatibility (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienHarper committed Jan 25, 2021
1 parent 9b4b30e commit 7d4bc6d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Event/ViewerEventSubscriber.php
Expand Up @@ -8,7 +8,7 @@
use DH\Auditor\Provider\Doctrine\DoctrineProvider;
use DH\AuditorBundle\Controller\ViewerController;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents;

Expand All @@ -24,8 +24,13 @@ public function __construct(Auditor $auditor)
$this->auditor = $auditor;
}

public function onKernelController(ControllerEvent $event): void
public function onKernelController(KernelEvent $event): void
{
// Symfony 3.4+ compatibility (no ControllerEvent typehint)
if (!method_exists($event, 'getController')) {
throw new NotFoundHttpException();
}

$controller = $event->getController();

// when a controller class defines multiple action methods, the controller
Expand Down

0 comments on commit 7d4bc6d

Please sign in to comment.