class MethodCallExpression
Hierarchy
- class \Twig\Node\Node implements \Twig\Node\Countable, \Twig\Node\IteratorAggregate
- class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
- class \Twig\Node\Expression\MethodCallExpression extends \Twig\Node\Expression\AbstractExpression
- class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
Expanded class hierarchy of MethodCallExpression
2 files declare their use of MethodCallExpression
- DefinedTest.php in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ DefinedTest.php - SafeAnalysisNodeVisitor.php in vendor/
twig/ twig/ src/ NodeVisitor/ SafeAnalysisNodeVisitor.php
File
-
vendor/
twig/ twig/ src/ Node/ Expression/ MethodCallExpression.php, line 16
Namespace
Twig\Node\ExpressionView source
class MethodCallExpression extends AbstractExpression {
public function __construct(AbstractExpression $node, string $method, ArrayExpression $arguments, int $lineno) {
trigger_deprecation('twig/twig', '3.15', 'The "%s" class is deprecated, use "%s" instead.', __CLASS__, MacroReferenceExpression::class);
parent::__construct([
'node' => $node,
'arguments' => $arguments,
], [
'method' => $method,
'safe' => false,
'is_defined_test' => false,
], $lineno);
if ($node instanceof NameExpression) {
$node->setAttribute('always_defined', true);
}
}
public function compile(Compiler $compiler) : void {
if ($this->getAttribute('is_defined_test')) {
$compiler->raw('method_exists($macros[')
->repr($this->getNode('node')
->getAttribute('name'))
->raw('], ')
->repr($this->getAttribute('method'))
->raw(')');
return;
}
$compiler->raw('CoreExtension::callMacro($macros[')
->repr($this->getNode('node')
->getAttribute('name'))
->raw('], ')
->repr($this->getAttribute('method'))
->raw(', ')
->subcompile($this->getNode('arguments'))
->raw(', ')
->repr($this->getTemplateLine())
->raw(', $context, $this->getSourceContext())');
}
}