Loading core/lib/Drupal/Component/DependencyInjection/Container.php +5 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,11 @@ public function __construct(array $container_definition = []) { * {@inheritdoc} */ public function get($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { if ($this->hasParameter('_deprecated_service_list')) { if ($deprecation = $this->getParameter('_deprecated_service_list')[$id] ?? '') { @trigger_error($deprecation, E_USER_DEPRECATED); } } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } Loading core/lib/Drupal/Core/CoreServiceProvider.php +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass; use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass; use Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass; use Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass; use Drupal\Core\DependencyInjection\Compiler\GuzzleMiddlewarePass; use Drupal\Core\DependencyInjection\Compiler\ContextProvidersPass; use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass; Loading Loading @@ -98,6 +99,7 @@ public function register(ContainerBuilder $container) { $container->addCompilerPass(new PluginManagerPass()); $container->addCompilerPass(new DependencySerializationTraitPass()); $container->addCompilerPass(new DeprecatedServicePass()); } /** Loading core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Sets the _deprecated_service_list parameter. * * @see \Drupal\Component\DependencyInjection\Container::get() */ class DeprecatedServicePass implements CompilerPassInterface { /** * {@inheritdoc} */ public function process(ContainerBuilder $container) { $deprecated_services = []; foreach ($container->getDefinitions() as $service_id => $definition) { if ($definition->isDeprecated()) { $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id); } } foreach ($container->getAliases() as $service_id => $definition) { if ($definition->isDeprecated()) { $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id); } } $container->setParameter('_deprecated_service_list', $deprecated_services); } } core/modules/system/tests/modules/deprecation_test/deprecation_test.services.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line services: deprecation_test.service: class: Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test. deprecation_test.alias: alias: deprecation_test.service deprecated: The "%alias_id%" alias is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test. core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -247,7 +247,7 @@ public function testExtensionCompatibilityChange(array $correct_info, array $bre if ($extension_type === 'theme') { $base_info['base theme'] = FALSE; } $folder_path = \Drupal::service('site.path') . "/{$extension_type}s/$extension_machine_name"; $folder_path = \Drupal::getContainer()->getParameter('site.path') . "/{$extension_type}s/$extension_machine_name"; $file_path = "$folder_path/$extension_machine_name.info.yml"; mkdir($folder_path, 0777, TRUE); file_put_contents($file_path, Yaml::encode($base_info + $correct_info)); Loading Loading @@ -380,7 +380,7 @@ public function testMissingExtension($extension_type) { if ($extension_type === 'theme') { $extension_info['base theme'] = FALSE; } $folder_path = \Drupal::service('site.path') . "/{$extension_type}s/$extension_machine_name"; $folder_path = \Drupal::getContainer()->getParameter('site.path') . "/{$extension_type}s/$extension_machine_name"; $file_path = "$folder_path/$extension_machine_name.info.yml"; mkdir($folder_path, 0777, TRUE); file_put_contents($file_path, Yaml::encode($extension_info)); Loading Loading
core/lib/Drupal/Component/DependencyInjection/Container.php +5 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,11 @@ public function __construct(array $container_definition = []) { * {@inheritdoc} */ public function get($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { if ($this->hasParameter('_deprecated_service_list')) { if ($deprecation = $this->getParameter('_deprecated_service_list')[$id] ?? '') { @trigger_error($deprecation, E_USER_DEPRECATED); } } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } Loading
core/lib/Drupal/Core/CoreServiceProvider.php +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass; use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass; use Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass; use Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass; use Drupal\Core\DependencyInjection\Compiler\GuzzleMiddlewarePass; use Drupal\Core\DependencyInjection\Compiler\ContextProvidersPass; use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass; Loading Loading @@ -98,6 +99,7 @@ public function register(ContainerBuilder $container) { $container->addCompilerPass(new PluginManagerPass()); $container->addCompilerPass(new DependencySerializationTraitPass()); $container->addCompilerPass(new DeprecatedServicePass()); } /** Loading
core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Sets the _deprecated_service_list parameter. * * @see \Drupal\Component\DependencyInjection\Container::get() */ class DeprecatedServicePass implements CompilerPassInterface { /** * {@inheritdoc} */ public function process(ContainerBuilder $container) { $deprecated_services = []; foreach ($container->getDefinitions() as $service_id => $definition) { if ($definition->isDeprecated()) { $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id); } } foreach ($container->getAliases() as $service_id => $definition) { if ($definition->isDeprecated()) { $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id); } } $container->setParameter('_deprecated_service_list', $deprecated_services); } }
core/modules/system/tests/modules/deprecation_test/deprecation_test.services.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line services: deprecation_test.service: class: Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test. deprecation_test.alias: alias: deprecation_test.service deprecated: The "%alias_id%" alias is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.
core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -247,7 +247,7 @@ public function testExtensionCompatibilityChange(array $correct_info, array $bre if ($extension_type === 'theme') { $base_info['base theme'] = FALSE; } $folder_path = \Drupal::service('site.path') . "/{$extension_type}s/$extension_machine_name"; $folder_path = \Drupal::getContainer()->getParameter('site.path') . "/{$extension_type}s/$extension_machine_name"; $file_path = "$folder_path/$extension_machine_name.info.yml"; mkdir($folder_path, 0777, TRUE); file_put_contents($file_path, Yaml::encode($base_info + $correct_info)); Loading Loading @@ -380,7 +380,7 @@ public function testMissingExtension($extension_type) { if ($extension_type === 'theme') { $extension_info['base theme'] = FALSE; } $folder_path = \Drupal::service('site.path') . "/{$extension_type}s/$extension_machine_name"; $folder_path = \Drupal::getContainer()->getParameter('site.path') . "/{$extension_type}s/$extension_machine_name"; $file_path = "$folder_path/$extension_machine_name.info.yml"; mkdir($folder_path, 0777, TRUE); file_put_contents($file_path, Yaml::encode($extension_info)); Loading