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
-------

e31a6e4534 use EmptyNode instead of an Nodes instance without children
This commit is contained in:
Fabien Potencier
2025-03-01 08:08:39 +01:00
+5 -1
View File
@@ -41,7 +41,11 @@ final class ModuleNode extends Node
if (!$embeddedTemplates instanceof Node) {
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));
$embeddedTemplates = new Nodes($embeddedTemplates ?? []);
if (null !== $embeddedTemplates) {
$embeddedTemplates = new Nodes($embeddedTemplates);
} else {
$embeddedTemplates = new EmptyNode();
}
}
$nodes = [