function ClassResolver::__construct

Same name in other branches
  1. 11.x core/lib/Drupal/Core/DependencyInjection/ClassResolver.php \Drupal\Core\DependencyInjection\ClassResolver::__construct()

Constructs a new ClassResolver object.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface|null $container: The service container.

File

core/lib/Drupal/Core/DependencyInjection/ClassResolver.php, line 21

Class

ClassResolver
Implements the class resolver interface supporting class names and services.

Namespace

Drupal\Core\DependencyInjection

Code

public function __construct(?ContainerInterface $container = NULL) {
    if ($this->container === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $container argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3419963', E_USER_DEPRECATED);
        $this->container = \Drupal::getContainer();
    }
}

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