mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
Avoid polluting ModuleNode::toString() with embedded templates
This commit is contained in:
@@ -38,6 +38,11 @@ final class ModuleNode extends Node
|
||||
if (!$body instanceof BodyNode) {
|
||||
trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class));
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
$nodes = [
|
||||
'body' => $body,
|
||||
|
||||
+9
-1
@@ -117,7 +117,15 @@ class Parser
|
||||
$this->expressionRefs = null;
|
||||
}
|
||||
|
||||
$node = new ModuleNode(new BodyNode([$body]), $this->parent, new Nodes($this->blocks), new Nodes($this->macros), new Nodes($this->traits), $this->embeddedTemplates, $stream->getSourceContext());
|
||||
$node = new ModuleNode(
|
||||
new BodyNode([$body]),
|
||||
$this->parent,
|
||||
$this->blocks ? new Nodes($this->blocks) : new EmptyNode(),
|
||||
$this->macros ? new Nodes($this->macros) : new EmptyNode(),
|
||||
$this->traits ? new Nodes($this->traits) : new EmptyNode(),
|
||||
$this->embeddedTemplates ? new Nodes($this->embeddedTemplates) : new EmptyNode(),
|
||||
$stream->getSourceContext(),
|
||||
);
|
||||
|
||||
$traverser = new NodeTraverser($this->env, $this->visitors);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user