Twig: [RFC] Rename (or alias) Environment -> Twig

Created on 30 May 2018  路  7Comments  路  Source: twigphp/Twig

It always a bit weird to write the following code:

    public function __construct(Environment $twig)
    {
        $this->twig = $twig;
    }

I would prefer to type-hint with Twig instead of Environment.

WDYT ?

Most helpful comment

@ericmorand $this->env does not make me think about twig :/ $env usually refers to environment variables

All 7 comments

Wouldn't this be better:

public function __construct(Environment $env)
{
    $this->env= $env;
}

@ericmorand $this->env does not make me think about twig :/ $env usually refers to environment variables

That would be Twig\Twig then, right? Twig_Environment worked better for sure.

as TwigEnvironment works well enough to not break BC.

will be fixed by #2857 :)

Thanks 馃榿

see https://github.com/twigphp/Twig/pull/2857#issuecomment-469601425 for the reasons why I won't do it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnapoli picture mnapoli  路  5Comments

ericmorand picture ericmorand  路  4Comments

maidmaid picture maidmaid  路  5Comments

Seldaek picture Seldaek  路  6Comments

mmarton picture mmarton  路  4Comments