Symfony\Component\DependencyInjection\Compiler\PassConfig::addPass PHP Method

addPass() public method

Adds a pass.
public addPass ( Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface $pass, string $type = self::TYPE_BEFORE_OPTIMIZATION )
$pass Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface A Compiler pass
$type string The pass type
    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;
    }

Usage Example

コード例 #1
0
ファイル: Kernel.php プロジェクト: protobile/framework
 /**
  * @param PassConfig $passConfig
  */
 public function configureContainerPass(PassConfig $passConfig)
 {
     $passConfig->addPass(new RegisterInputPass());
     $passConfig->addPass(new RegisterOutputPass());
     $passConfig->addPass(new RegisterApplicationPass());
     $passConfig->addPass(new RegisterCommandsPass());
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Compiler\PassConfig::addPass