use EmptyNode instead of an Nodes instance without children

This commit is contained in:
Christian Flothmann
2025-02-28 22:12:08 +01:00
parent 4692c36145
commit e31a6e4534
+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 = [