From 4c6ea225b3cbec62107c095ed3565209308ab8b7 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 4 Mar 2024 18:32:00 +0000
Subject: [PATCH] Issue #3110671 by andypost, longwave: Remove remaining
 deprecated code from taxonomy.module

---
 .../migrate/process/ForumVocabulary.php       | 62 -------------------
 core/modules/taxonomy/src/TermStorage.php     | 15 -----
 .../taxonomy/src/TermStorageInterface.php     | 27 --------
 .../tests/src/Kernel/TermKernelTest.php       | 28 ---------
 4 files changed, 132 deletions(-)
 delete mode 100644 core/modules/taxonomy/src/Plugin/migrate/process/ForumVocabulary.php

diff --git a/core/modules/taxonomy/src/Plugin/migrate/process/ForumVocabulary.php b/core/modules/taxonomy/src/Plugin/migrate/process/ForumVocabulary.php
deleted file mode 100644
index 7ea58afb2001..000000000000
--- a/core/modules/taxonomy/src/Plugin/migrate/process/ForumVocabulary.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-namespace Drupal\taxonomy\Plugin\migrate\process;
-
-use Drupal\migrate\MigrateExecutableInterface;
-use Drupal\migrate\ProcessPluginBase;
-use Drupal\migrate\Row;
-
-/**
- * Checks if the vocabulary being migrated is the one used for forums.
- *
- * Drupal 8 Forum is expecting specific machine names for its field and
- * vocabulary names. This process plugin forces a given machine name to the
- * field or vocabulary that is being migrated.
- *
- * The 'forum_vocabulary' source property is evaluated in the
- * d6_taxonomy_vocabulary or d7_taxonomy_vocabulary source plugins and is set to
- * true if the vocabulary vid being migrated is the same as the one in the
- * 'forum_nav_vocabulary' variable on the source site.
- *
- * Example:
- *
- * @code
- * process:
- *   field_name:
- *     plugin: forum_vocabulary
- *     machine_name: taxonomy_forums
- * @endcode
- *
- * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use
- *   \Drupal\forum\Plugin\migrate\process\ForumVocabulary instead.
- *
- * @see https://www.drupal.org/node/3387830
- */
-class ForumVocabulary extends ProcessPluginBase {
-
-  /**
-   * Constructs a MigrationLookup object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
-    @trigger_error(__CLASS__ . 'is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\forum\Plugin\migrate\process\ForumVocabulary instead. See https://www.drupal.org/node/3387830', E_USER_DEPRECATED);
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
-    if ($row->getSourceProperty('forum_vocabulary') && !empty($this->configuration['machine_name'])) {
-      $value = $this->configuration['machine_name'];
-    }
-    return $value;
-  }
-
-}
diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php
index e121a1744a3a..6ef45f18aa4d 100644
--- a/core/modules/taxonomy/src/TermStorage.php
+++ b/core/modules/taxonomy/src/TermStorage.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\taxonomy;
 
-use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
 use Drupal\Core\Entity\Sql\TableMappingInterface;
 
@@ -88,20 +87,6 @@ public function resetCache(array $ids = NULL) {
     parent::resetCache($ids);
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function deleteTermHierarchy($tids) {
-    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically cleared when deleting a taxonomy term. See https://www.drupal.org/node/2936675', E_USER_DEPRECATED);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function updateTermHierarchy(EntityInterface $term) {
-    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically updated when updating a taxonomy term. See https://www.drupal.org/node/2936675', E_USER_DEPRECATED);
-  }
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/modules/taxonomy/src/TermStorageInterface.php b/core/modules/taxonomy/src/TermStorageInterface.php
index 1f995204b280..9cfcdc399ebb 100644
--- a/core/modules/taxonomy/src/TermStorageInterface.php
+++ b/core/modules/taxonomy/src/TermStorageInterface.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\taxonomy;
 
-use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\ContentEntityStorageInterface;
 
 /**
@@ -10,32 +9,6 @@
  */
 interface TermStorageInterface extends ContentEntityStorageInterface {
 
-  /**
-   * Removed reference to terms from term_hierarchy.
-   *
-   * @param array $tids
-   *   Array of terms that need to be removed from hierarchy.
-   *
-   * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Parent
-   *   references are automatically cleared when deleting a taxonomy term.
-   *
-   * @see https://www.drupal.org/node/2936675
-   */
-  public function deleteTermHierarchy($tids);
-
-  /**
-   * Updates terms hierarchy information with the hierarchy trail of it.
-   *
-   * @param \Drupal\Core\Entity\EntityInterface $term
-   *   Term entity that needs to be added to term hierarchy information.
-   *
-   * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Parent
-   *   references are automatically updated when updating a taxonomy term.
-   *
-   * @see https://www.drupal.org/node/2936675
-   */
-  public function updateTermHierarchy(EntityInterface $term);
-
   /**
    * Finds all parents of a given term ID.
    *
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
index b23fe6509d8f..d4a66d43eb8e 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
@@ -171,34 +171,6 @@ public function testTermPreview() {
     $this->assertNotEmpty(trim($rendered), 'Term is able to be rendered.');
   }
 
-  /**
-   * @covers \Drupal\taxonomy\TermStorage::deleteTermHierarchy
-   * @group legacy
-   */
-  public function testDeleteTermHierarchyDeprecation(): void {
-    $vocabulary = $this->createVocabulary();
-    $term = $this->createTerm($vocabulary);
-
-    /** @var \Drupal\taxonomy\TermStorageInterface $storage */
-    $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
-    $this->expectDeprecation('Drupal\taxonomy\TermStorage::deleteTermHierarchy() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically cleared when deleting a taxonomy term. See https://www.drupal.org/node/2936675');
-    $storage->deleteTermHierarchy([$term->tid]);
-  }
-
-  /**
-   * @covers \Drupal\taxonomy\TermStorage::updateTermHierarchy
-   * @group legacy
-   */
-  public function testUpdateTermHierarchyDeprecation(): void {
-    $vocabulary = $this->createVocabulary();
-    $term = $this->createTerm($vocabulary);
-
-    /** @var \Drupal\taxonomy\TermStorageInterface $storage */
-    $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
-    $this->expectDeprecation('Drupal\taxonomy\TermStorage::updateTermHierarchy() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically updated when updating a taxonomy term. See https://www.drupal.org/node/2936675');
-    $storage->updateTermHierarchy($term);
-  }
-
   /**
    * Tests revision log access.
    */
-- 
GitLab