mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-23 16:48:28 +00:00
Merge branch '2.x' into 3.x
* 2.x: added support for macros on "is defined" tests
This commit is contained in:
@@ -674,6 +674,11 @@ class ExpressionParser
|
||||
$arguments = $this->parseArguments(true);
|
||||
}
|
||||
|
||||
if ('defined' === $name && $node instanceof NameExpression && null !== $alias = $this->parser->getImportedSymbol('function', $node->getAttribute('name'))) {
|
||||
$node = new MethodCallExpression($alias['node'], $alias['name'], new ArrayExpression([], $node->getTemplateLine()), $node->getTemplateLine());
|
||||
$node->setAttribute('safe', true);
|
||||
}
|
||||
|
||||
return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user