src/Container/TwigContainer.php
public static function build(ContainerBuilder $builder, array $options){
        $builder
            ->add(
                "twig",
                \Twig_Environment::class,
                [],
                [
                    \Twig\Environment::class,
                    \Twig_Environment::class,
                ]
            )
            ->add(
                "twig.loader",
                \Twig_Loader_Chain::class,
                [],
                [
                    \Twig\Loader\LoaderInterface::class,
                    \Twig_LoaderInterface::class,
                ]
            )
        ;

        $builder->parameter(\Twig_Environment::class)
            ->add("loader", $builder->lazyGet("twig.loader"))
        ;

        $builder->parameter(\Twig_Loader_Chain::class)
            ->add(
                "options",
                $builder->lazyArray([
                    "debug" => $builder->LazyGetShareValue("kernel.debug"),
                    "cache" => $builder->LazyGetShareValue("twig.cache"),
                ])
            )
        ;

        $builder->addShareValue(
            "twig.cache",
            $builder->lazyCallable(
                function($kernel){
                    return
                        $kernel->getConfig()->getProjectDir()
                        . implode(DIRECTORY_SEPARATOR, ["", "var", "twig"])
                    ;
                },
                [$builder->lazyGet("kernel")]
            )
        );
    }
public static function build(ContainerBuilder $builder, array $options){
        $builder
            ->add(
                "twig",
                \Twig_Environment::class,
                [],
                [
                    \Twig\Environment::class,
                    \Twig_Environment::class,
                ]
            )
            ->add(
                "twig.loader",
                \Twig_Loader_Chain::class,
                [],
                [
                    \Twig\Loader\LoaderInterface::class,
                    \Twig_LoaderInterface::class,
                ]
            )
        ;

        $builder->parameter(\Twig_Environment::class)
            ->add("loader", $builder->lazyGet("twig.loader"))
        ;

        $builder->parameter(\Twig_Loader_Chain::class)
            ->add(
                "options",
                $builder->lazyArray([
                    "debug" => $builder->LazyGetShareValue("kernel.debug"),
                    "cache" => $builder->LazyGetShareValue("twig.cache"),
                ])
            )
        ;

        $builder->addShareValue(
            "twig.cache",
            $builder->lazyCallable(
                function($kernel){
                    return
                        $kernel->getConfig()->getProjectDir()
                        . implode(DIRECTORY_SEPARATOR, ["", "var", "twig"])
                    ;
                },
                [$builder->lazyGet("kernel")]
            )
        );
    }
{@inheritdoc}