diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 64dbef610a4962504a3b05c74c00410b78ccfb6f..89f75f0ad1deb649c1217bb8e7072af584d83251 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -14374,12 +14374,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/config/tests/config_events_test/src/EventSubscriber.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function _config_import_test_config_import_steps_alter\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/config/tests/config_import_test/config_import_test.module', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\config_import_test\\\\EventSubscriber\\:\\:onConfigDelete\\(\\) has no return type specified\\.$#', diff --git a/core/modules/config/tests/config_import_test/config_import_test.module b/core/modules/config/tests/config_import_test/config_import_test.module deleted file mode 100644 index 7b33703e560f09fadc3d918564c77d181c9528af..0000000000000000000000000000000000000000 --- a/core/modules/config/tests/config_import_test/config_import_test.module +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -/** - * @file - * Provides configuration import test helpers. - */ - -declare(strict_types=1); - -use Drupal\Core\Config\ConfigImporter; - -/** - * Implements configuration synchronization step added by an alter for testing. - * - * @param array $context - * The batch context. - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The configuration importer. - */ -function _config_import_test_config_import_steps_alter(&$context, ConfigImporter $config_importer) { - $GLOBALS['hook_config_test']['config_import_steps_alter'] = TRUE; - if (\Drupal::state()->get('config_import_steps_alter.error', FALSE)) { - $context['results']['errors'][] = '_config_import_test_config_import_steps_alter batch error'; - $config_importer->logError('_config_import_test_config_import_steps_alter ConfigImporter error'); - } - $context['finished'] = 1; -} - -/** - * Implements hook_modules_installed(). - */ -function config_import_test_modules_installed($modules, $is_syncing): void { - \Drupal::state()->set('config_import_test_modules_installed.list', $modules); -} diff --git a/core/modules/config/tests/config_import_test/src/Hook/ConfigImportTestHooks.php b/core/modules/config/tests/config_import_test/src/Hook/ConfigImportTestHooks.php index 1b1802229863b626791cc724dfa877504a074159..784a354d83662a3477356fb34f25b12ad8e5071d 100644 --- a/core/modules/config/tests/config_import_test/src/Hook/ConfigImportTestHooks.php +++ b/core/modules/config/tests/config_import_test/src/Hook/ConfigImportTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\config_import_test\Hook; +use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Hook\Attribute\Hook; /** @@ -16,7 +17,32 @@ class ConfigImportTestHooks { */ #[Hook('config_import_steps_alter')] public function configImportStepsAlter(&$sync_steps): void { - $sync_steps[] = '_config_import_test_config_import_steps_alter'; + $sync_steps[] = [$this, 'stepAlter']; + } + + /** + * Implements hook_modules_installed(). + */ + #[Hook('modules_installed')] + public function modulesInstalled($modules, $is_syncing): void { + \Drupal::state()->set('config_import_test_modules_installed.list', $modules); + } + + /** + * Implements configuration synchronization step added by an alter for testing. + * + * @param array $context + * The batch context. + * @param \Drupal\Core\Config\ConfigImporter $config_importer + * The configuration importer. + */ + public function stepAlter(&$context, ConfigImporter $config_importer): void { + $GLOBALS['hook_config_test']['config_import_steps_alter'] = TRUE; + if (\Drupal::state()->get('config_import_steps_alter.error', FALSE)) { + $context['results']['errors'][] = '_config_import_test_config_import_steps_alter batch error'; + $config_importer->logError('_config_import_test_config_import_steps_alter ConfigImporter error'); + } + $context['finished'] = 1; } }