DeprecatedServicePass.php

Same filename and directory in other branches
  1. 9 core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php
  2. 10 core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php

Namespace

Drupal\Core\DependencyInjection\Compiler

File

core/lib/Drupal/Core/DependencyInjection/Compiler/DeprecatedServicePass.php

View source
<?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) : void {
    $deprecated_services = [];
    foreach ($container->getDefinitions() as $service_id => $definition) {
      if ($definition->isDeprecated()) {
        $deprecated_services[$service_id] = $definition->getDeprecation($service_id)['message'];
      }
    }
    foreach ($container->getAliases() as $service_id => $definition) {
      if ($definition->isDeprecated()) {
        $deprecated_services[$service_id] = $definition->getDeprecation($service_id)['message'];
      }
    }
    $container->setParameter('_deprecated_service_list', $deprecated_services);
  }

}

Classes

Title Deprecated Summary
DeprecatedServicePass Sets the _deprecated_service_list parameter.

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