public function PassConfig::addPass

Adds a pass.

@api

Parameters

CompilerPassInterface $pass A Compiler pass:

string $type The pass type:

Throws

InvalidArgumentException when a pass type doesn't exist

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php, line 105

Class

PassConfig
Compiler Pass Configuration

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) {
  $property = $type . 'Passes';
  if (!isset($this->{$property})) {
    throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
  }
  $passes =& $this->{$property};
  $passes[] = $pass;
}