diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index 84ecd9fdb16..c88478f62d0 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -8,7 +8,7 @@ use Drupal\Core\Authentication\AuthenticationProviderInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\KernelEvents; @@ -105,10 +105,10 @@ class AuthenticationSubscriber implements EventSubscriberInterface { * authentication methods (e.g. basic auth) require that a challenge is sent * to the client. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The exception event. */ - public function onExceptionSendChallenge(GetResponseForExceptionEvent $event) { + public function onExceptionSendChallenge(ExceptionEvent $event) { if (isset($this->challengeProvider) && $event->isMasterRequest()) { $request = $event->getRequest(); $exception = $event->getThrowable(); @@ -124,9 +124,9 @@ class AuthenticationSubscriber implements EventSubscriberInterface { /** * Detect disallowed authentication methods on access denied exceptions. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event */ - public function onExceptionAccessDenied(GetResponseForExceptionEvent $event) { + public function onExceptionAccessDenied(ExceptionEvent $event) { if (isset($this->filter) && $event->isMasterRequest()) { $request = $event->getRequest(); $exception = $event->getThrowable(); diff --git a/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php index 9ad04b7bf97..f690647144b 100644 --- a/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php @@ -10,7 +10,7 @@ use Drupal\Core\Routing\RedirectDestinationInterface; use Drupal\Core\Url; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -65,7 +65,7 @@ class CustomPageExceptionHtmlSubscriber extends DefaultExceptionHtmlSubscriber { /** * {@inheritdoc} */ - public function on403(GetResponseForExceptionEvent $event) { + public function on403(ExceptionEvent $event) { $custom_403_path = $this->configFactory->get('system.site')->get('page.403'); if (!empty($custom_403_path)) { $this->makeSubrequestToCustomPath($event, $custom_403_path, Response::HTTP_FORBIDDEN); @@ -75,7 +75,7 @@ class CustomPageExceptionHtmlSubscriber extends DefaultExceptionHtmlSubscriber { /** * {@inheritdoc} */ - public function on404(GetResponseForExceptionEvent $event) { + public function on404(ExceptionEvent $event) { $custom_404_path = $this->configFactory->get('system.site')->get('page.404'); if (!empty($custom_404_path)) { $this->makeSubrequestToCustomPath($event, $custom_404_path, Response::HTTP_NOT_FOUND); @@ -85,14 +85,14 @@ class CustomPageExceptionHtmlSubscriber extends DefaultExceptionHtmlSubscriber { /** * Makes a subrequest to retrieve the custom error page. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. * @param string $custom_path * The custom path to which to make a subrequest for this error message. * @param int $status_code * The status code for the error being handled. */ - protected function makeSubrequestToCustomPath(GetResponseForExceptionEvent $event, $custom_path, $status_code) { + protected function makeSubrequestToCustomPath(ExceptionEvent $event, $custom_path, $status_code) { $url = Url::fromUserInput($custom_path); if ($url->isRouted()) { $access_result = $this->accessManager->checkNamedRoute($url->getRouteName(), $url->getRouteParameters(), NULL, TRUE); diff --git a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php index 03eebdc7d19..c7920d3c4cd 100644 --- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php @@ -7,7 +7,7 @@ use Drupal\Core\Routing\RedirectDestinationInterface; use Drupal\Core\Utility\Error; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -83,10 +83,10 @@ class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase { /** * Handles a 4xx error for HTML. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on4xx(GetResponseForExceptionEvent $event) { + public function on4xx(ExceptionEvent $event) { if (($exception = $event->getThrowable()) && $exception instanceof HttpExceptionInterface) { $this->makeSubrequest($event, '/system/4xx', $exception->getStatusCode()); } @@ -95,44 +95,44 @@ class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase { /** * Handles a 401 error for HTML. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on401(GetResponseForExceptionEvent $event) { + public function on401(ExceptionEvent $event) { $this->makeSubrequest($event, '/system/401', Response::HTTP_UNAUTHORIZED); } /** * Handles a 403 error for HTML. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on403(GetResponseForExceptionEvent $event) { + public function on403(ExceptionEvent $event) { $this->makeSubrequest($event, '/system/403', Response::HTTP_FORBIDDEN); } /** * Handles a 404 error for HTML. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on404(GetResponseForExceptionEvent $event) { + public function on404(ExceptionEvent $event) { $this->makeSubrequest($event, '/system/404', Response::HTTP_NOT_FOUND); } /** * Makes a subrequest to retrieve the default error page. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. * @param string $url * The path/url to which to make a subrequest for this error message. * @param int $status_code * The status code for the error being handled. */ - protected function makeSubrequest(GetResponseForExceptionEvent $event, $url, $status_code) { + protected function makeSubrequest(ExceptionEvent $event, $url, $status_code) { $request = $event->getRequest(); $exception = $event->getThrowable(); diff --git a/core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php index fdf2bc6086e..1acda86f3c4 100644 --- a/core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php @@ -5,7 +5,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Form\EnforcedResponse; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\KernelEvents; /** @@ -16,7 +16,7 @@ class EnforcedFormResponseSubscriber implements EventSubscriberInterface { /** * Replaces the response in case an EnforcedResponseException was thrown. */ - public function onKernelException(GetResponseForExceptionEvent $event) { + public function onKernelException(ExceptionEvent $event) { if ($response = EnforcedResponse::createFromException($event->getThrowable())) { // Setting the response stops the event propagation. $event->setResponse($response); diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionDetectNeedsInstallSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionDetectNeedsInstallSubscriber.php index 1020d95a712..ae0fcbebdbd 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionDetectNeedsInstallSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionDetectNeedsInstallSubscriber.php @@ -6,7 +6,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Installer\InstallerRedirectTrait; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\KernelEvents; /** @@ -35,10 +35,10 @@ class ExceptionDetectNeedsInstallSubscriber implements EventSubscriberInterface /** * Handles errors for this subscriber. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); if ($this->shouldRedirectToInstaller($exception, $this->connection)) { // Only redirect if this is an HTML response (i.e., a user trying to view diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php index 618ec346d1a..57ad3729a9d 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php @@ -5,7 +5,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\CacheableJsonResponse; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; /** * Default handling for JSON errors. @@ -31,10 +31,10 @@ class ExceptionJsonSubscriber extends HttpExceptionSubscriberBase { /** * Handles all 4xx errors for JSON. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on4xx(GetResponseForExceptionEvent $event) { + public function on4xx(ExceptionEvent $event) { /** @var \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $exception */ $exception = $event->getThrowable(); diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php index 7ad38972dd5..83052a5306b 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php @@ -5,7 +5,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Utility\Error; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\KernelEvents; @@ -34,10 +34,10 @@ class ExceptionLoggingSubscriber implements EventSubscriberInterface { /** * Log 403 errors. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on403(GetResponseForExceptionEvent $event) { + public function on403(ExceptionEvent $event) { $request = $event->getRequest(); $this->logger->get('access denied')->warning('@uri', ['@uri' => $request->getRequestUri()]); } @@ -45,10 +45,10 @@ class ExceptionLoggingSubscriber implements EventSubscriberInterface { /** * Log 404 errors. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on404(GetResponseForExceptionEvent $event) { + public function on404(ExceptionEvent $event) { $request = $event->getRequest(); $this->logger->get('page not found')->warning('@uri', ['@uri' => $request->getRequestUri()]); } @@ -56,10 +56,10 @@ class ExceptionLoggingSubscriber implements EventSubscriberInterface { /** * Log not-otherwise-specified errors, including HTTP 500. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onError(GetResponseForExceptionEvent $event) { + public function onError(ExceptionEvent $event) { $exception = $event->getThrowable(); $error = Error::decodeException($exception); $this->logger->get('php')->log($error['severity_level'], '%type: @message in %function (line %line of %file).', $error); @@ -73,10 +73,10 @@ class ExceptionLoggingSubscriber implements EventSubscriberInterface { /** * Log all exceptions. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); $method = 'onError'; diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php index dd65cde76f9..00ef848c0f5 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php @@ -3,7 +3,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Utility\Error; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; /** * Custom handling of errors when in a system-under-test. @@ -31,9 +31,9 @@ class ExceptionTestSiteSubscriber extends HttpExceptionSubscriberBase { * original code. It's quite possible that this entire method is now * vestigial and can be removed. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event */ - public function on500(GetResponseForExceptionEvent $event) { + public function on500(ExceptionEvent $event) { $exception = $event->getThrowable(); $error = Error::decodeException($exception); diff --git a/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php index 99c7b021f56..61159e97945 100644 --- a/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php @@ -5,7 +5,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Component\Utility\Html; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; /** @@ -62,10 +62,10 @@ class Fast404ExceptionHtmlSubscriber extends HttpExceptionSubscriberBase { /** * Handles a 404 error for HTML. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on404(GetResponseForExceptionEvent $event) { + public function on404(ExceptionEvent $event) { $request = $event->getRequest(); $config = $this->configFactory->get('system.performance'); diff --git a/core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php index cfa191e0c5b..33a8dd3fd3f 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinalExceptionSubscriber.php @@ -8,7 +8,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Utility\Error; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\KernelEvents; @@ -73,10 +73,10 @@ class FinalExceptionSubscriber implements EventSubscriberInterface { /** * Handles exceptions for this subscriber. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); $error = Error::decodeException($exception); diff --git a/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php b/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php index c431bdf605e..ed6c4d3c2cf 100644 --- a/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php +++ b/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php @@ -3,7 +3,7 @@ namespace Drupal\Core\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\KernelEvents; @@ -17,14 +17,14 @@ use Symfony\Component\HttpKernel\KernelEvents; * method: * * @code - * public function on404(GetResponseForExceptionEvent $event) {} + * public function on404(ExceptionEvent $event) {} * @endcode * * To implement a fallback for the entire 4xx class of codes, implement the * method: * * @code - * public function on4xx(GetResponseForExceptionEvent $event) {} + * public function on4xx(ExceptionEvent $event) {} * @endcode * * That method should then call $event->setResponse() to set the response object @@ -82,10 +82,10 @@ abstract class HttpExceptionSubscriberBase implements EventSubscriberInterface { /** * Handles errors for this subscriber. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); // Make the exception available for example when rendering a block. diff --git a/core/lib/Drupal/Core/Form/EnforcedResponse.php b/core/lib/Drupal/Core/Form/EnforcedResponse.php index e70c4a195f2..9d18e9871af 100644 --- a/core/lib/Drupal/Core/Form/EnforcedResponse.php +++ b/core/lib/Drupal/Core/Form/EnforcedResponse.php @@ -34,14 +34,14 @@ class EnforcedResponse extends Response { * for an enforced response. Otherwise it would be impossible to find an * exception thrown from within a twig template. * - * @param \Exception $e + * @param \Throwable $e * The exception where the enforced response is to be extracted from. * * @return static|null * The enforced response or NULL if the exception chain does not contain a * \Drupal\Core\Form\EnforcedResponseException exception. */ - public static function createFromException(\Exception $e) { + public static function createFromException(\Throwable $e) { while ($e) { if ($e instanceof EnforcedResponseException) { return new static($e->getResponse()); diff --git a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php index d9f92487b35..4a4e2043c4a 100644 --- a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php +++ b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php @@ -14,7 +14,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\KernelEvents; /** @@ -76,10 +76,10 @@ class FormAjaxSubscriber implements EventSubscriberInterface { /** * Catches a form AJAX exception and build a response from it. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); $request = $event->getRequest(); diff --git a/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php b/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php index 332b905b539..aa2b8c830c8 100644 --- a/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php +++ b/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php @@ -9,7 +9,7 @@ use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\KernelEvents; @@ -72,9 +72,9 @@ class ParamConversionEnhancer implements EnhancerInterface, EventSubscriberInter /** * Catches failed parameter conversions and throw a 404 instead. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); if ($exception instanceof ParamNotConvertedException) { $event->setThrowable(new NotFoundHttpException($exception->getMessage(), $exception)); diff --git a/core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php b/core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php index 6151b82f6de..abefad4a860 100644 --- a/core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php @@ -9,7 +9,7 @@ use Drupal\jsonapi\JsonApiResource\NullIncludedData; use Drupal\jsonapi\ResourceResponse; use Drupal\jsonapi\Routing\Routes; use Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber as SerializationDefaultExceptionSubscriber; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpException; /** @@ -40,7 +40,7 @@ class DefaultExceptionSubscriber extends SerializationDefaultExceptionSubscriber /** * {@inheritdoc} */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { if (!$this->isJsonApiExceptionEvent($event)) { return; } @@ -55,7 +55,7 @@ class DefaultExceptionSubscriber extends SerializationDefaultExceptionSubscriber /** * {@inheritdoc} */ - protected function setEventResponse(GetResponseForExceptionEvent $event, $status) { + protected function setEventResponse(ExceptionEvent $event, $status) { /* @var \Symfony\Component\HttpKernel\Exception\HttpException $exception */ $exception = $event->getThrowable(); $response = new ResourceResponse(new JsonApiDocumentTopLevel(new ErrorCollection([$exception]), new NullIncludedData(), new LinkCollection([])), $exception->getStatusCode(), $exception->getHeaders()); @@ -69,13 +69,13 @@ class DefaultExceptionSubscriber extends SerializationDefaultExceptionSubscriber * The JSON:API format is supported if the format is explicitly set or the * request is for a known JSON:API route. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $exception_event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $exception_event * The exception event. * * @return bool * TRUE if it needs to be formatted using JSON:API. FALSE otherwise. */ - protected function isJsonApiExceptionEvent(GetResponseForExceptionEvent $exception_event) { + protected function isJsonApiExceptionEvent(ExceptionEvent $exception_event) { $request = $exception_event->getRequest(); $parameters = $request->attributes->all(); return $request->getRequestFormat() === 'api_json' || (bool) Routes::getResourceTypeNameFromParameters($parameters); diff --git a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php index 9801acf3a77..7d93e7201a5 100644 --- a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php +++ b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php @@ -9,7 +9,7 @@ use Drupal\Core\Routing\UrlGeneratorInterface; use Drupal\Core\State\StateInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\KernelEvents; @@ -80,10 +80,10 @@ class NodeTranslationExceptionSubscriber implements EventSubscriberInterface { /** * Redirects not found node translations using the key value collection. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The exception event. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); // If this is not a 404, we don't need to check for a redirection. diff --git a/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php b/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php index 1f1e538df17..a2c82b57618 100644 --- a/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php @@ -6,7 +6,7 @@ use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\CacheableResponse; use Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\Serializer\SerializerInterface; /** @@ -64,10 +64,10 @@ class DefaultExceptionSubscriber extends HttpExceptionSubscriberBase { /** * Handles all 4xx errors for all serialization failures. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function on4xx(GetResponseForExceptionEvent $event) { + public function on4xx(ExceptionEvent $event) { /** @var \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $exception */ $exception = $event->getThrowable(); $request = $event->getRequest(); diff --git a/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php b/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php index a9af659ce1b..840de7e5ff2 100644 --- a/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php +++ b/core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php @@ -7,7 +7,7 @@ use Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Serializer\Serializer; @@ -27,7 +27,7 @@ class DefaultExceptionSubscriberTest extends UnitTestCase { $request->setRequestFormat('json'); $e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message'); - $event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); $subscriber = new DefaultExceptionSubscriber(new Serializer([], [new JsonEncoder()]), []); $subscriber->on4xx($event); $response = $event->getResponse(); diff --git a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php index b0ee2d23e04..cd2499b4dca 100644 --- a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php @@ -7,7 +7,7 @@ use Drupal\Core\Routing\RouteMatch; use Drupal\Core\Url; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\KernelEvents; @@ -41,10 +41,10 @@ class AccessDeniedSubscriber implements EventSubscriberInterface { /** * Redirects users when access is denied. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ - public function onException(GetResponseForExceptionEvent $event) { + public function onException(ExceptionEvent $event) { $exception = $event->getThrowable(); if ($exception instanceof AccessDeniedHttpException) { $route_name = RouteMatch::createFromRequest($event->getRequest())->getRouteName(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php index f33cd40d1c9..114b35ad75b 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php @@ -12,7 +12,7 @@ use Drupal\Core\Url; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Routing\RequestContext; @@ -139,7 +139,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase { return new HtmlResponse($request->getMethod()); })); - $event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); + $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); $this->customPageSubscriber->onException($event); @@ -166,7 +166,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase { return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all())); })); - $event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); + $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo')); $this->customPageSubscriber->onException($event); $response = $event->getResponse(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php index b40dd73df7b..57d62d14ece 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Http\Exception\CacheableMethodNotAllowedHttpException; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -27,7 +27,7 @@ class ExceptionJsonSubscriberTest extends UnitTestCase { public function testOn4xx(HttpExceptionInterface $exception, $expected_response_class) { $kernel = $this->prophesize(HttpKernelInterface::class); $request = Request::create('/test'); - $event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); $subscriber = new ExceptionJsonSubscriber(); $subscriber->on4xx($event); $response = $event->getResponse(); diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php index 9902fdd2b9f..4b64df59917 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php @@ -6,7 +6,7 @@ use Drupal\Core\EventSubscriber\FinalExceptionSubscriber; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -28,7 +28,7 @@ class FinalExceptionSubscriberTest extends UnitTestCase { // of this so we'll hard code it here. $request->setRequestFormat('bananas'); $e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message'); - $event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); + $event = new ExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e); $subscriber = new TestDefaultExceptionSubscriber($config_factory); $subscriber->setStringTranslation($this->getStringTranslationStub()); $subscriber->onException($event); diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index f57594baad7..80f9640f37d 100644 --- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -12,7 +12,7 @@ use Drupal\Core\Messenger\MessengerInterface; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -191,7 +191,7 @@ class FormAjaxSubscriberTest extends UnitTestCase { $exception = new BrokenPostRequestException(32 * 1e6); $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]); - $event = new GetResponseForExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); $this->subscriber->onException($event); $this->assertTrue($event->isAllowingCustomResponseCode()); $actual_response = $event->getResponse(); @@ -256,11 +256,11 @@ class FormAjaxSubscriberTest extends UnitTestCase { * @param \Symfony\Component\HttpFoundation\Response|null $expected_response * The response expected to be set on the event. * - * @return \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent + * @return \Symfony\Component\HttpKernel\Event\ExceptionEvent * The event used to derive the response. */ protected function assertResponseFromException(Request $request, \Exception $exception, $expected_response) { - $event = new GetResponseForExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new ExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception); $this->subscriber->onException($event); $this->assertSame($expected_response, $event->getResponse());