diff --git a/core/lib/Drupal/Component/Plugin/PluginInspectionInterface.php b/core/lib/Drupal/Component/Plugin/PluginInspectionInterface.php index 63e61e5602..7840fa2bc1 100644 --- a/core/lib/Drupal/Component/Plugin/PluginInspectionInterface.php +++ b/core/lib/Drupal/Component/Plugin/PluginInspectionInterface.php @@ -33,7 +33,7 @@ public function getPluginDefinition(); * Checks if the plugin is deprecated. * * @return bool - * Returns TRUE if the plugin is deprecated. + * Returns TRUE if the plugin is deprecated, FALSE otherwise. */ public function isDeprecated(): bool; diff --git a/core/lib/Drupal/Component/Plugin/PluginInspectionTrait.php b/core/lib/Drupal/Component/Plugin/PluginInspectionTrait.php index ff03136b34..40446d6262 100644 --- a/core/lib/Drupal/Component/Plugin/PluginInspectionTrait.php +++ b/core/lib/Drupal/Component/Plugin/PluginInspectionTrait.php @@ -41,7 +41,7 @@ public function getPluginDefinition() { * {@inheritdoc} */ public function isDeprecated(): bool { - return !empty($this->getDeprecationMessage()); + return !is_null($this->getDeprecationMessage()); } /** @@ -69,8 +69,9 @@ public function getDeprecationMessage(): ?string { * call to this method in your plugin base class's constructor. */ protected function checkDeprecation() { - if ($this->isDeprecated()) { - @trigger_error($this->getDeprecationMessage(), E_USER_DEPRECATED); + $message = $this->getDeprecationMessage(); + if (!is_null($message)) { + @trigger_error($message, E_USER_DEPRECATED); } } diff --git a/core/modules/migrate/src/Plugin/MigrationPluginManager.php b/core/modules/migrate/src/Plugin/MigrationPluginManager.php index b8ef8600b2..f9690a8a2b 100644 --- a/core/modules/migrate/src/Plugin/MigrationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrationPluginManager.php @@ -265,19 +265,4 @@ protected function findDefinitions() { }); } - /** - * Filters out deprecated plugins. - * - * @param \Drupal\migrate\Plugin\MigrationInterface[] $migrations - * Array of migrations to filter. - * - * @return \Drupal\migrate\Plugin\MigrationInterface[] - * Array of filtered migrations. - */ - public function filterMigrations(array $migrations): array { - return array_filter($migrations, function ($migration) { - return !$migration->isDeprecated(); - }); - } - } diff --git a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php index 203df5a061..9c8354fa55 100644 --- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php +++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php @@ -123,7 +123,10 @@ protected function getMigrations($database_state_key, $drupal_version) { $version_tag = 'Drupal ' . $drupal_version; /** @var \Drupal\migrate\Plugin\MigrationInterface[] $all_migrations */ $all_migrations = $this->getMigrationPluginManager()->createInstancesByTag($version_tag); - $all_migrations = $this->getMigrationPluginManager()->filterMigrations($all_migrations); + $all_migrations = array_filter($all_migrations, function ($migration) { + // Filter out deprecated migrations. + return !$migration->isDeprecated(); + }); // Unset the node migrations that should not run based on the type of node // migration. That is, if this is a complete node migration then unset the