From 5a8f40dacd26447b74d09e80218608e5ac5b0315 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 23 Apr 2024 00:34:43 +0100 Subject: [PATCH] Issue #3442365 by catch, Sandeep Sanwale: Removed deprecated code in taxonomy module --- .../Plugin/views/argument/IndexTidDepth.php | 22 +---------- .../src/Plugin/views/argument/Taxonomy.php | 19 +--------- .../Views/ViewsArgumentDeprecationTest.php | 38 ------------------- 3 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 core/modules/taxonomy/tests/src/Kernel/Views/ViewsArgumentDeprecationTest.php diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php index 7e1a245365a..17408369123 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php @@ -2,7 +2,6 @@ namespace Drupal\taxonomy\Plugin\views\argument; -use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; @@ -25,28 +24,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPluginInterface { use TaxonomyIndexDepthQueryTrait; - /** - * @var \Drupal\Core\Entity\EntityStorageInterface - * - * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no - * replacement. - * - * @see https://www.drupal.org/node/3427843 - */ - protected $termStorage; - /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, protected EntityStorageInterface|EntityRepositoryInterface $entityRepository) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, protected EntityRepositoryInterface $entityRepository) { parent::__construct($configuration, $plugin_id, $plugin_definition); - - if ($entityRepository instanceof EntityStorageInterface) { - // @phpstan-ignore-next-line - $this->termStorage = $entityRepository; - @trigger_error('Calling ' . __CLASS__ . '::__construct() with the $termStorage argument as \Drupal\Core\Entity\EntityStorageInterface is deprecated in drupal:10.3.0 and it will require Drupal\Core\Entity\EntityRepositoryInterface in drupal:11.0.0. See https://www.drupal.org/node/3427843', E_USER_DEPRECATED); - $this->entityRepository = \Drupal::service('entity.repository'); - } } /** @@ -129,7 +111,7 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin if (!empty($term)) { return $term->label(); } - // TODO review text + // @todo review text return $this->t('No name'); } diff --git a/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php index 3ebf992c8d6..dcdd2e5cfa3 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php @@ -3,7 +3,6 @@ namespace Drupal\taxonomy\Plugin\views\argument; use Drupal\Core\Entity\EntityRepositoryInterface; -use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\views\Attribute\ViewsArgument; use Drupal\views\Plugin\views\argument\NumericArgument; @@ -19,27 +18,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; )] class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterface { - /** - * @var \Drupal\Core\Entity\EntityStorageInterface - * - * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no - * replacement. - * - * @see https://www.drupal.org/node/3427843 - */ - protected $termStorage; - /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, protected EntityStorageInterface|EntityRepositoryInterface $entityRepository) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, protected EntityRepositoryInterface $entityRepository) { parent::__construct($configuration, $plugin_id, $plugin_definition); - if ($entityRepository instanceof EntityStorageInterface) { - // @phpstan-ignore-next-line - $this->termStorage = $this->entityRepository; - @trigger_error('Calling ' . __CLASS__ . '::__construct() with the $termStorage argument as \Drupal\Core\Entity\EntityStorageInterface is deprecated in drupal:10.3.0 and it will require Drupal\Core\Entity\EntityRepositoryInterface in drupal:11.0.0. See https://www.drupal.org/node/3427843', E_USER_DEPRECATED); - $this->entityRepository = \Drupal::service('entity.repository'); - } } /** diff --git a/core/modules/taxonomy/tests/src/Kernel/Views/ViewsArgumentDeprecationTest.php b/core/modules/taxonomy/tests/src/Kernel/Views/ViewsArgumentDeprecationTest.php deleted file mode 100644 index b11fa4979a7..00000000000 --- a/core/modules/taxonomy/tests/src/Kernel/Views/ViewsArgumentDeprecationTest.php +++ /dev/null @@ -1,38 +0,0 @@ -expectDeprecation('Calling Drupal\taxonomy\Plugin\views\argument\Taxonomy::__construct() with the $termStorage argument as \Drupal\Core\Entity\EntityStorageInterface is deprecated in drupal:10.3.0 and it will require Drupal\Core\Entity\EntityRepositoryInterface in drupal:11.0.0. See https://www.drupal.org/node/3427843'); - $plugin = \Drupal::service('plugin.manager.views.argument')->createInstance('taxonomy_views_argument_test', []); - $this->assertInstanceOf(TaxonomyViewsArgumentTest::class, $plugin); - } - -}