Merge branch '2.x' into 3.x

* 2.x:
  added support for macros on "is defined" tests
This commit is contained in:
Fabien Potencier
2019-05-17 18:56:16 +02:00
5 changed files with 63 additions and 1 deletions
+5
View File
@@ -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());
}