Skip to content
Snippets Groups Projects
Commit 4f05e526 authored by catch's avatar catch
Browse files

Issue #3055832 by BR0kEN, Wim Leers: Remove ResourceResponseValidator's unused...

Issue #3055832 by BR0kEN, Wim Leers: Remove ResourceResponseValidator's unused $serializer property/service dependency
parent 17bd9ce0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -208,7 +208,7 @@ services: ...@@ -208,7 +208,7 @@ services:
- { name: event_subscriber } - { name: event_subscriber }
jsonapi.resource_response_validator.subscriber: jsonapi.resource_response_validator.subscriber:
class: Drupal\jsonapi\EventSubscriber\ResourceResponseValidator class: Drupal\jsonapi\EventSubscriber\ResourceResponseValidator
arguments: ['@jsonapi.serializer', '@logger.channel.jsonapi', '@module_handler', '@app.root'] arguments: ['@logger.channel.jsonapi', '@module_handler', '@app.root']
calls: calls:
- [setValidator, []] - [setValidator, []]
tags: tags:
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* Response subscriber that validates a JSON:API response. * Response subscriber that validates a JSON:API response.
...@@ -28,13 +27,6 @@ ...@@ -28,13 +27,6 @@
*/ */
class ResourceResponseValidator implements EventSubscriberInterface { class ResourceResponseValidator implements EventSubscriberInterface {
/**
* The serializer.
*
* @var \Symfony\Component\Serializer\SerializerInterface
*/
protected $serializer;
/** /**
* The JSON:API logger channel. * The JSON:API logger channel.
* *
...@@ -68,8 +60,6 @@ class ResourceResponseValidator implements EventSubscriberInterface { ...@@ -68,8 +60,6 @@ class ResourceResponseValidator implements EventSubscriberInterface {
/** /**
* Constructs a ResourceResponseValidator object. * Constructs a ResourceResponseValidator object.
* *
* @param \Symfony\Component\Serializer\SerializerInterface $serializer
* The serializer.
* @param \Psr\Log\LoggerInterface $logger * @param \Psr\Log\LoggerInterface $logger
* The JSON:API logger channel. * The JSON:API logger channel.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
...@@ -77,8 +67,7 @@ class ResourceResponseValidator implements EventSubscriberInterface { ...@@ -77,8 +67,7 @@ class ResourceResponseValidator implements EventSubscriberInterface {
* @param string $app_root * @param string $app_root
* The application's root file path. * The application's root file path.
*/ */
public function __construct(SerializerInterface $serializer, LoggerInterface $logger, ModuleHandlerInterface $module_handler, $app_root) { public function __construct(LoggerInterface $logger, ModuleHandlerInterface $module_handler, $app_root) {
$this->serializer = $serializer;
$this->logger = $logger; $this->logger = $logger;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->appRoot = $app_root; $this->appRoot = $app_root;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Drupal\Tests\jsonapi\Unit\EventSubscriber; namespace Drupal\Tests\jsonapi\Unit\EventSubscriber;
use Drupal\jsonapi\Encoder\JsonEncoder;
use Drupal\jsonapi\EventSubscriber\ResourceResponseValidator; use Drupal\jsonapi\EventSubscriber\ResourceResponseValidator;
use Drupal\jsonapi\ResourceType\ResourceType; use Drupal\jsonapi\ResourceType\ResourceType;
use Drupal\jsonapi\Routing\Routes; use Drupal\jsonapi\Routing\Routes;
...@@ -15,7 +14,6 @@ ...@@ -15,7 +14,6 @@
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\Serializer;
/** /**
* @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator * @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator
...@@ -47,12 +45,7 @@ public function setUp() { ...@@ -47,12 +45,7 @@ public function setUp() {
$module_path = dirname(dirname(dirname(dirname(__DIR__)))); $module_path = dirname(dirname(dirname(dirname(__DIR__))));
$module->getPath()->willReturn($module_path); $module->getPath()->willReturn($module_path);
$module_handler->getModule('jsonapi')->willReturn($module->reveal()); $module_handler->getModule('jsonapi')->willReturn($module->reveal());
$encoders = [new JsonEncoder()];
if (class_exists(JsonSchemaEncoder::class)) {
$encoders[] = new JsonSchemaEncoder();
}
$subscriber = new ResourceResponseValidator( $subscriber = new ResourceResponseValidator(
new Serializer([], $encoders),
$this->prophesize(LoggerInterface::class)->reveal(), $this->prophesize(LoggerInterface::class)->reveal(),
$module_handler->reveal(), $module_handler->reveal(),
'' ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment