public function ContainerBuilder::addCompilerPass

Adds a compiler pass.

@api

Parameters

CompilerPassInterface $pass A compiler pass:

string $type The type of compiler pass:

Return value

ContainerBuilder The current instance

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 306

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) {
  if (null === $this->compiler) {
    $this->compiler = new Compiler();
  }
  $this->compiler
    ->addPass($pass, $type);
  $this
    ->addObjectResource($pass);
  return $this;
}