vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/TwigBundle.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\TwigBundle;
  11. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass;
  12. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
  13. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass;
  14. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
  15. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
  16. use Symfony\Component\Console\Application;
  17. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  18. use Symfony\Component\DependencyInjection\ContainerBuilder;
  19. use Symfony\Component\HttpKernel\Bundle\Bundle;
  20. /**
  21.  * Bundle.
  22.  *
  23.  * @author Fabien Potencier <fabien@symfony.com>
  24.  */
  25. class TwigBundle extends Bundle
  26. {
  27.     public function build(ContainerBuilder $container)
  28.     {
  29.         parent::build($container);
  30.         // ExtensionPass must be run before the FragmentRendererPass as it adds tags that are processed later
  31.         $container->addCompilerPass(new ExtensionPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION10);
  32.         $container->addCompilerPass(new TwigEnvironmentPass());
  33.         $container->addCompilerPass(new TwigLoaderPass());
  34.         $container->addCompilerPass(new ExceptionListenerPass());
  35.         $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
  36.     }
  37.     public function registerCommands(Application $application)
  38.     {
  39.         // noop
  40.     }
  41. }