Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MethodCallExpression.php

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

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\Expression
View 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())');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AbstractExpression::hasExplicitParentheses public function
AbstractExpression::isGenerator public function
AbstractExpression::setExplicitParentheses public function
MethodCallExpression::compile public function Overrides Node::compile
MethodCallExpression::__construct public function Overrides Node::__construct
Node::$attributeNameDeprecations private property @var array<string, NameDeprecation>
Node::$attributes protected property
Node::$lineno protected property
Node::$nodeNameDeprecations private property @var array<string, NameDeprecation>
Node::$nodes protected property
Node::$sourceContext private property
Node::$tag protected property
Node::count public function
Node::deprecateAttribute public function
Node::deprecateNode public function
Node::getAttribute public function
Node::getIterator public function
Node::getNode public function
Node::getNodeTag public function
Node::getSourceContext public function
Node::getTemplateLine public function
Node::getTemplateName public function
Node::hasAttribute public function
Node::hasNode public function
Node::removeAttribute public function
Node::removeNode public function
Node::setAttribute public function
Node::setNode public function 1
Node::setNodeTag public function @internal
Node::setSourceContext public function
Node::__toString public function
RSS feed
Powered by Drupal