From 092520ee5bee2c24e5541ec7e75174fac0eb3996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Fejfar?= Date: Fri, 7 Jun 2019 17:44:51 +0200 Subject: [PATCH 1/2] GetResponseForExceptionEvent is deprecated in favor of ExceptionEvent --- event_dispatcher.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/event_dispatcher.rst b/event_dispatcher.rst index 653feb11f4b..a1375f1e20c 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -27,12 +27,12 @@ The most common way to listen to an event is to register an **event listener**:: namespace App\EventListener; use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; + use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class ExceptionListener { - public function onKernelException(GetResponseForExceptionEvent $event) + public function onKernelException(ExceptionEvent $event) { // You get the exception object from the received event $exception = $event->getException(); @@ -63,7 +63,7 @@ The most common way to listen to an event is to register an **event listener**:: .. tip:: Each event receives a slightly different type of ``$event`` object. For - the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`. + the ``kernel.exception`` event, it is :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent`. Check out the :doc:`Symfony events reference ` to see what type of object each event provides. @@ -207,11 +207,11 @@ or a "sub request":: // src/EventListener/RequestListener.php namespace App\EventListener; - use Symfony\Component\HttpKernel\Event\GetResponseEvent; + use \Symfony\Component\HttpKernel\Event\ExceptionEvent; class RequestListener { - public function onKernelRequest(GetResponseEvent $event) + public function onKernelRequest(ExceptionEvent $event) { if (!$event->isMasterRequest()) { // don't do anything if it's not the master request From 9e2d569db2815eef3994592b46ff421f75d038ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Fejfar?= Date: Fri, 7 Jun 2019 17:46:15 +0200 Subject: [PATCH 2/2] Removed excessive slash --- event_dispatcher.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event_dispatcher.rst b/event_dispatcher.rst index a1375f1e20c..0bdeb418735 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -207,7 +207,7 @@ or a "sub request":: // src/EventListener/RequestListener.php namespace App\EventListener; - use \Symfony\Component\HttpKernel\Event\ExceptionEvent; + use Symfony\Component\HttpKernel\Event\ExceptionEvent; class RequestListener {