diff --git a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php index f425aed59f..47ea8800ae 100644 --- a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php +++ b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php @@ -11,7 +11,7 @@ use Drupal\serialization\Normalizer\CacheableNormalizerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Serializer\SerializerInterface; @@ -61,10 +61,10 @@ public function __construct(SerializerInterface $serializer, RendererInterface $ /** * Serializes ResourceResponse responses' data, and removes that data. * - * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event + * @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event * The event to process. */ - public function onResponse(FilterResponseEvent $event) { + public function onResponse(ResponseEvent $event) { $response = $event->getResponse(); if (!$response instanceof ResourceResponseInterface) { return; diff --git a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php index eab2d9f89b..305ed3e138 100644 --- a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php +++ b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php @@ -17,7 +17,7 @@ use Drupal\Tests\UnitTestCase; use Prophecy\Argument; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Routing\Route; use Symfony\Component\Serializer\Serializer; @@ -39,7 +39,7 @@ public function testSerialization($data, $expected_response = FALSE) { $handler_response = new ResourceResponse($data); $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, @@ -142,7 +142,7 @@ public function testOnResponseWithCacheableResponse($methods, array $supported_r // The ResourceResponseSubscriber must then generate a response body and // transform it to a plain CacheableResponse object. $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, @@ -192,7 +192,7 @@ public function testOnResponseWithUncacheableResponse($methods, array $supported // The ResourceResponseSubscriber must then generate a response body and // transform it to a plain Response object. $resource_response_subscriber = $this->getFunctioningResourceResponseSubscriber($route_match); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->prophesize(HttpKernelInterface::class)->reveal(), $request, HttpKernelInterface::MASTER_REQUEST,