class DeprecatedServicePass

Same name in other branches
  1. 10 core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php \Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass
  2. 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php \Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass

Sets the _deprecated_service_list parameter.

Hierarchy

  • class \Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface

Expanded class hierarchy of DeprecatedServicePass

See also

\Drupal\Component\DependencyInjection\Container::get()

1 file declares its use of DeprecatedServicePass
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php

File

core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php, line 13

Namespace

Drupal\Core\DependencyInjection\Compiler
View source
class DeprecatedServicePass implements CompilerPassInterface {
    
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container) {
        $deprecated_services = [];
        foreach ($container->getDefinitions() as $service_id => $definition) {
            if ($definition->isDeprecated()) {
                // @todo: remove when Drupal requires Symfony 5. See
                // https://www.drupal.org/project/drupal/issues/3197482
                if (method_exists($definition, 'getDeprecation')) {
                    $deprecated_services[$service_id] = $definition->getDeprecation($service_id)['message'];
                }
                else {
                    $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id);
                }
            }
        }
        foreach ($container->getAliases() as $service_id => $definition) {
            if ($definition->isDeprecated()) {
                // @todo: remove when Drupal requires Symfony 5. See
                // https://www.drupal.org/project/drupal/issues/3197482
                if (method_exists($definition, 'getDeprecation')) {
                    $deprecated_services[$service_id] = $definition->getDeprecation($service_id)['message'];
                }
                else {
                    $deprecated_services[$service_id] = $definition->getDeprecationMessage($service_id);
                }
            }
        }
        $container->setParameter('_deprecated_service_list', $deprecated_services);
    }

}

Members

Title Sort descending Modifiers Object type Summary
DeprecatedServicePass::process public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.