From 7ab5bbcee416e412128067020ea5738a3a7152db Mon Sep 17 00:00:00 2001 From: Lee Rowlands Date: Mon, 2 Dec 2019 11:38:11 +1000 Subject: [PATCH] Issue #3097439 by andypost, longwave, martin107: Remove all @deprecated code in the Config module --- .../src/Controller/ConfigController.php | 10 +---- .../config/src/Form/ConfigImportForm.php | 10 +---- core/modules/config/src/Form/ConfigSync.php | 42 +----------------- .../Tests/AssertConfigEntityImportTrait.php | 44 ------------------- .../config/src/Tests/SchemaCheckTestTrait.php | 17 ------- 5 files changed, 3 insertions(+), 120 deletions(-) delete mode 100644 core/modules/config/src/Tests/AssertConfigEntityImportTrait.php delete mode 100644 core/modules/config/src/Tests/SchemaCheckTestTrait.php diff --git a/core/modules/config/src/Controller/ConfigController.php b/core/modules/config/src/Controller/ConfigController.php index 78f2ce80f89..4f101d6f7bc 100644 --- a/core/modules/config/src/Controller/ConfigController.php +++ b/core/modules/config/src/Controller/ConfigController.php @@ -113,22 +113,14 @@ class ConfigController implements ContainerInjectionInterface { * @param \Drupal\Core\Config\ImportStorageTransformer $import_transformer * The import transformer service. */ - public function __construct(StorageInterface $target_storage, StorageInterface $sync_storage, ConfigManagerInterface $config_manager, FileDownloadController $file_download_controller, DiffFormatter $diff_formatter, FileSystemInterface $file_system, StorageInterface $export_storage = NULL, ImportStorageTransformer $import_transformer = NULL) { + public function __construct(StorageInterface $target_storage, StorageInterface $sync_storage, ConfigManagerInterface $config_manager, FileDownloadController $file_download_controller, DiffFormatter $diff_formatter, FileSystemInterface $file_system, StorageInterface $export_storage, ImportStorageTransformer $import_transformer) { $this->targetStorage = $target_storage; $this->syncStorage = $sync_storage; $this->configManager = $config_manager; $this->fileDownloadController = $file_download_controller; $this->diffFormatter = $diff_formatter; $this->fileSystem = $file_system; - if (is_null($export_storage)) { - @trigger_error('The config.storage.export service must be passed to ConfigController::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3037022.', E_USER_DEPRECATED); - $export_storage = \Drupal::service('config.storage.export'); - } $this->exportStorage = $export_storage; - if (is_null($import_transformer)) { - @trigger_error('The config.import_transformer service must be passed to ConfigController::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3066005.', E_USER_DEPRECATED); - $import_transformer = \Drupal::service('config.import_transformer'); - } $this->importTransformer = $import_transformer; } diff --git a/core/modules/config/src/Form/ConfigImportForm.php b/core/modules/config/src/Form/ConfigImportForm.php index 7632e184081..9d0d1e9da70 100644 --- a/core/modules/config/src/Form/ConfigImportForm.php +++ b/core/modules/config/src/Form/ConfigImportForm.php @@ -48,17 +48,9 @@ class ConfigImportForm extends FormBase { * @param \Drupal\Core\Site\Settings $settings * The settings object. */ - public function __construct(StorageInterface $config_storage, FileSystemInterface $file_system = NULL, Settings $settings = NULL) { + public function __construct(StorageInterface $config_storage, FileSystemInterface $file_system, Settings $settings) { $this->configStorage = $config_storage; - if (!isset($file_system)) { - @trigger_error('The $file_system parameter was added in Drupal 8.8.0 and will be required in 9.0.0. See https://www.drupal.org/node/3021434.', E_USER_DEPRECATED); - $file_system = \Drupal::service('file_system'); - } $this->fileSystem = $file_system; - if (!isset($settings)) { - @trigger_error('The $settings parameter was added in Drupal 8.8.0 and will be required in 9.0.0. See https://www.drupal.org/node/2980712.', E_USER_DEPRECATED); - $settings = \Drupal::service('settings'); - } $this->settings = $settings; } diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php index 71fb3681f18..2d8be271147 100644 --- a/core/modules/config/src/Form/ConfigSync.php +++ b/core/modules/config/src/Form/ConfigSync.php @@ -150,7 +150,7 @@ class ConfigSync extends FormBase { * @param \Drupal\Core\Config\ImportStorageTransformer $import_transformer * The import transformer service. */ - public function __construct(StorageInterface $sync_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer, ModuleExtensionList $extension_list_module, ImportStorageTransformer $import_transformer = NULL) { + public function __construct(StorageInterface $sync_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, RendererInterface $renderer, ModuleExtensionList $extension_list_module, ImportStorageTransformer $import_transformer) { $this->syncStorage = $sync_storage; $this->activeStorage = $active_storage; $this->snapshotStorage = $snapshot_storage; @@ -163,10 +163,6 @@ class ConfigSync extends FormBase { $this->themeHandler = $theme_handler; $this->renderer = $renderer; $this->moduleExtensionList = $extension_list_module; - if (is_null($import_transformer)) { - @trigger_error('The config.import_transformer service must be passed to ConfigSync::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3066005.', E_USER_DEPRECATED); - $import_transformer = \Drupal::service('config.import_transformer'); - } $this->importTransformer = $import_transformer; } @@ -390,40 +386,4 @@ class ConfigSync extends FormBase { } } - /** - * Processes the config import batch and persists the importer. - * - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The batch config importer object to persist. - * @param string $sync_step - * The synchronization step to do. - * @param array $context - * The batch context. - * - * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use - * \Drupal\Core\Config\Importer\ConfigImporterBatch::process() instead. - * - * @see https://www.drupal.org/node/2897299 - */ - public static function processBatch(ConfigImporter $config_importer, $sync_step, &$context) { - @trigger_error('\Drupal\config\Form\ConfigSync::processBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::process() instead. See https://www.drupal.org/node/2897299'); - ConfigImporterBatch::process($config_importer, $sync_step, $context); - } - - /** - * Finish batch. - * - * This function is a static function to avoid serializing the ConfigSync - * object unnecessarily. - * - * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use - * \Drupal\Core\Config\Importer\ConfigImporterBatch::finish() instead. - * - * @see https://www.drupal.org/node/2897299 - */ - public static function finishBatch($success, $results, $operations) { - @trigger_error('\Drupal\config\Form\ConfigSync::finishBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::finish() instead. See https://www.drupal.org/node/2897299'); - ConfigImporterBatch::finish($success, $results, $operations); - } - } diff --git a/core/modules/config/src/Tests/AssertConfigEntityImportTrait.php b/core/modules/config/src/Tests/AssertConfigEntityImportTrait.php deleted file mode 100644 index a7517ed362d..00000000000 --- a/core/modules/config/src/Tests/AssertConfigEntityImportTrait.php +++ /dev/null @@ -1,44 +0,0 @@ -uuid(); - $entity_type_id = $entity->getEntityTypeId(); - $original_data = $entity->toArray(); - // Copy everything to sync. - $this->copyConfig(\Drupal::service('config.storage'), \Drupal::service('config.storage.sync')); - // Delete the configuration from active. Don't worry about side effects of - // deleting config like fields cleaning up field storages. The coming import - // should recreate everything as necessary. - $entity->delete(); - $this->configImporter()->reset()->import(); - $imported_entity = \Drupal::service('entity.repository')->loadEntityByUuid($entity_type_id, $entity_uuid); - $this->assertIdentical($original_data, $imported_entity->toArray()); - } - -} diff --git a/core/modules/config/src/Tests/SchemaCheckTestTrait.php b/core/modules/config/src/Tests/SchemaCheckTestTrait.php deleted file mode 100644 index d0f0aaa57d1..00000000000 --- a/core/modules/config/src/Tests/SchemaCheckTestTrait.php +++ /dev/null @@ -1,17 +0,0 @@ -