<?phpnamespace App\EventSubscriber;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\HttpKernel\Event\ControllerEvent;class TwigEventSubscriber implements EventSubscriberInterface{ public function onControllerEvent(ControllerEvent $event) { // ... } public static function getSubscribedEvents() { return [ ControllerEvent::class => 'onControllerEvent', ]; }}