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

Breadcrumb

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

function FunctionExpression::__construct

Overrides Node::__construct

File

vendor/twig/twig/src/Node/Expression/FunctionExpression.php, line 22

Class

FunctionExpression

Namespace

Twig\Node\Expression

Code

public function __construct(TwigFunction|string $function, Node $arguments, int $lineno) {
    if ($function instanceof TwigFunction) {
        $name = $function->getName();
    }
    else {
        $name = $function;
        trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFunction" when creating a "%s" function of type "%s" is deprecated.', $name, static::class);
    }
    parent::__construct([
        'arguments' => $arguments,
    ], [
        'name' => $name,
        'type' => 'function',
        'is_defined_test' => false,
    ], $lineno);
    if ($function instanceof TwigFunction) {
        $this->setAttribute('twig_callable', $function);
    }
    $this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12'));
    $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12'));
}
RSS feed
Powered by Drupal