$dispatcher->
removeListener(KernelEvents::EXCEPTION,
$this->
onKernelException(...
));
} /**
* Handles security related exceptions.
*/
public function onKernelException(ExceptionEvent
$event): void
{ $exception =
$event->
getThrowable();
do { if ($exception instanceof AuthenticationException
) { $this->
handleAuthenticationException($event,
$exception);
return;
} if ($exception instanceof AccessDeniedException
) { $this->
handleAccessDeniedException($event,
$exception);
return;
} if ($exception instanceof LazyResponseException
) {