Skip to content

Commit ffd5159

Browse files
committed
minor #4608 use EmptyNode instead of an Nodes instance without children (xabbuh)
This PR was merged into the 3.x branch. Discussion ---------- use EmptyNode instead of an Nodes instance without children Commits ------- e31a6e4 use EmptyNode instead of an Nodes instance without children
2 parents 4692c36 + e31a6e4 commit ffd5159

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Node/ModuleNode.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public function __construct(Node $body, ?AbstractExpression $parent, Node $block
4141
if (!$embeddedTemplates instanceof Node) {
4242
trigger_deprecation('twig/twig', '3.21', \sprintf('Not passing a "%s" instance as the "embedded_templates" argument of the "%s" constructor is deprecated.', Node::class, static::class));
4343

44-
$embeddedTemplates = new Nodes($embeddedTemplates ?? []);
44+
if (null !== $embeddedTemplates) {
45+
$embeddedTemplates = new Nodes($embeddedTemplates);
46+
} else {
47+
$embeddedTemplates = new EmptyNode();
48+
}
4549
}
4650

4751
$nodes = [

0 commit comments

Comments
 (0)