function NullCoalesceExpression::__construct
Parameters
AbstractExpression $left:
AbstractExpression $right:
Overrides ConditionalExpression::__construct
File
-
vendor/
twig/ twig/ src/ Node/ Expression/ NullCoalesceExpression.php, line 29
Class
Namespace
Twig\Node\ExpressionCode
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);
}