Allow Twig 3
garak opened this issue · comments
Twig 3 has been released a few days ago, we should add support for it
I'm trying to find a solution, but I'm stuck with errors MenuExtensionTest
.
Our current implementation is calling directly loadTemplate
method of Twig\Environment
class, but it looks like such method is kind of internal and not meant to be called from outside. So, method signature is changed in Twig 3 and I don't know how to handle this.
I tried a possible solution: adding a TwigTestTemplate
class that extends Twig\Template
and doing:
return Environment::MAJOR_VERSION < 3 ?
$twig->loadTemplate('index') :
$twig->loadTemplate(TwigTestTemplate::class, 'index' $index);
in the last line of our 'getTemplate` method.
It doesn't work.
I get an exception:
Twig\Error\RuntimeError: Failed to load Twig template "index", index "": cache might be corrupted in "index"
@stof do you have any suggestions?