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

Breadcrumb

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

function NullCoalesceExpression::__construct

Parameters

AbstractExpression $left:

AbstractExpression $right:

Overrides ConditionalExpression::__construct

File

vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php, line 29

Class

NullCoalesceExpression

Namespace

Twig\Node\Expression

Code

public function __construct(Node $left, Node $right, int $lineno) {
    if (!$left instanceof AbstractExpression) {
        trigger_deprecation('twig/twig', '3.15', 'Not passing a "%s" instance to the "left" argument of "%s" is deprecated ("%s" given).', AbstractExpression::class, static::class, get_class($left));
    }
    if (!$right instanceof AbstractExpression) {
        trigger_deprecation('twig/twig', '3.15', 'Not passing a "%s" instance to the "right" argument of "%s" is deprecated ("%s" given).', AbstractExpression::class, static::class, get_class($right));
    }
    $test = new DefinedTest(clone $left, new TwigTest('defined'), new EmptyNode(), $left->getTemplateLine());
    // for "block()", we don't need the null test as the return value is always a string
    if (!$left instanceof BlockReferenceExpression) {
        $test = new AndBinary($test, new NotUnary(new NullTest($left, new TwigTest('null'), new EmptyNode(), $left->getTemplateLine()), $left->getTemplateLine()), $left->getTemplateLine());
    }
    parent::__construct($test, $left, $right, $lineno);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal