unset($parameters['_route'
],
$parameters['_controller'
]);
$request->attributes->
set('_route_params',
$parameters);
} catch (ResourceNotFoundException
$e) { $message =
sprintf('No route found for "%s %s"',
$request->
getMethod(),
$request->
getUriForPath($request->
getPathInfo()));
if ($referer =
$request->headers->
get('referer'
)) { $message .=
sprintf(' (from "%s")',
$referer);
} throw new NotFoundHttpException($message,
$e);
} catch (MethodNotAllowedException
$e) { $message =
sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)',
$request->
getMethod(),
$request->
getUriForPath($request->
getPathInfo()),
implode(', ',
$e->
getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->
getAllowedMethods(),
$message,
$e);
} } public function onKernelException(ExceptionEvent
$event): void
{ if (!
$this->debug || !
($e =
$event->
getThrowable()) instanceof NotFoundHttpException
) { return;
}