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 ?
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.
Most helpful comment
@ericmorand
$this->envdoes not make me think about twig :/$envusually refers to environment variables