From 9228776a4d79c6b0d6c9139806713ac7e5fd3f09 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Wed, 24 Apr 2024 21:31:18 +0100
Subject: [PATCH] Issue #3443205 by andypost, smustgrave: Remove deprecated
 code from migration modules

---
 .../src/Plugin/migrate/destination/Config.php | 24 +++++++--------
 .../migrate_drupal_ui/src/Form/ReviewForm.php | 30 +++----------------
 2 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Config.php b/core/modules/migrate/src/Plugin/migrate/destination/Config.php
index bfa4da591967..0f2db8872da3 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/Config.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/Config.php
@@ -86,13 +86,6 @@ class Config extends DestinationBase implements ContainerFactoryPluginInterface,
    */
   protected $language_manager;
 
-  /**
-   * The typed config manager service.
-   *
-   * @var \Drupal\Core\Config\TypedConfigManagerInterface
-   */
-  protected TypedConfigManagerInterface $typedConfigManager;
-
   /**
    * Constructs a Config destination object.
    *
@@ -108,21 +101,24 @@ class Config extends DestinationBase implements ContainerFactoryPluginInterface,
    *   The configuration factory.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   The language manager.
-   * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
+   * @param \Drupal\Core\Config\TypedConfigManagerInterface $typedConfigManager
    *   The typed config manager.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager, TypedConfigManagerInterface $typed_config_manager = NULL) {
+  public function __construct(
+    array $configuration,
+    $plugin_id,
+    $plugin_definition,
+    MigrationInterface $migration,
+    ConfigFactoryInterface $config_factory,
+    LanguageManagerInterface $language_manager,
+    protected TypedConfigManagerInterface $typedConfigManager,
+  ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
     $this->config = $config_factory->getEditable($configuration['config_name']);
     $this->language_manager = $language_manager;
     if ($this->isTranslationDestination()) {
       $this->supportsRollback = TRUE;
     }
-    if ($typed_config_manager === NULL) {
-      @trigger_error('Calling ' . __METHOD__ . '() without the $typed_config_manager argument is deprecated in drupal:10.3.0 and is removed in drupal:11.0.0. See https://www.drupal.org/node/3440502', E_USER_DEPRECATED);
-      $typed_config_manager = \Drupal::service(TypedConfigManagerInterface::class);
-    }
-    $this->typedConfigManager = $typed_config_manager;
   }
 
   /**
diff --git a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php
index 336734d0c476..08172325a6f3 100644
--- a/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php
+++ b/core/modules/migrate_drupal_ui/src/Form/ReviewForm.php
@@ -5,10 +5,8 @@
 use Drupal\Component\Datetime\TimeInterface;
 use Drupal\Core\Batch\BatchBuilder;
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
 use Drupal\Core\Extension\Exception\UnknownExtensionException;
 use Drupal\Core\Extension\ModuleExtensionList;
-use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\TempStore\PrivateTempStoreFactory;
@@ -35,12 +33,6 @@
  * @internal
  */
 class ReviewForm extends MigrateUpgradeFormBase {
-  use DeprecatedServicePropertyTrait;
-
-  /**
-   * The service properties that should raise a deprecation error.
-   */
-  private array $deprecatedProperties = ['moduleHandler' => 'module_handler'];
 
   /**
    * The migrations.
@@ -56,11 +48,6 @@ class ReviewForm extends MigrateUpgradeFormBase {
    */
   protected $migrationState;
 
-  /**
-   * Module extension list.
-   */
-  protected ModuleExtensionList $moduleExtensionList;
-
   /**
    * Source system data set in buildForm().
    *
@@ -81,9 +68,9 @@ class ReviewForm extends MigrateUpgradeFormBase {
    *   Migration state service.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory service.
-   * @param \Drupal\Core\Extension\ModuleExtensionList|\Drupal\Core\Extension\ModuleHandlerInterface $module_extension_list
+   * @param \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList
    *   The module extension list.
-   * @param \Drupal\Component\Datetime\TimeInterface|null $time
+   * @param \Drupal\Component\Datetime\TimeInterface $time
    *   The time service.
    */
   public function __construct(
@@ -92,20 +79,11 @@ public function __construct(
     PrivateTempStoreFactory $tempstore_private,
     MigrationState $migrationState,
     ConfigFactoryInterface $config_factory,
-    ModuleExtensionList|ModuleHandlerInterface $module_extension_list,
-    protected ?TimeInterface $time = NULL,
+    protected ModuleExtensionList $moduleExtensionList,
+    protected TimeInterface $time,
   ) {
     parent::__construct($config_factory, $migration_plugin_manager, $state, $tempstore_private);
     $this->migrationState = $migrationState;
-    if ($this->time === NULL) {
-      @trigger_error('Calling ' . __METHOD__ . ' without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3112298', E_USER_DEPRECATED);
-      $this->time = \Drupal::service('datetime.time');
-    }
-    if ($module_extension_list instanceof ModuleHandlerInterface) {
-      @trigger_error('Calling ' . __METHOD__ . '() with the $module_extension_list argument as ModuleHandlerInterface is deprecated in drupal:10.3.0 and will be required in drupal:12.0.0. See https://www.drupal.org/node/3310017', E_USER_DEPRECATED);
-      $module_extension_list = \Drupal::service('extension.list.module');
-    }
-    $this->moduleExtensionList = $module_extension_list;
   }
 
   /**
-- 
GitLab