From c7d138f93ced3456b7e539680b559461ec1b5b38 Mon Sep 17 00:00:00 2001 From: Bruno Ferme Gasparin Date: Wed, 25 Oct 2017 11:32:59 -0200 Subject: [PATCH 1/2] Fixed StackNodeVisitor for latest 1.* twig version --- lib/TwigStack/NodeVisitor/StackNodeVisitor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php index 7781779..bbfae04 100644 --- a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php +++ b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php @@ -54,7 +54,7 @@ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) */ private function handleModuleNode(\Twig_Node_Module $node) { - if ($node->hasNode('body') && null === $node->getNode('parent')) { + if ($node->hasNode('body') && ! $node->hasNode('parent')) { $body = $node->getNode('body'); $node->setNode('body', new StackBodyNode($body)); } @@ -70,4 +70,4 @@ public function getPriority() { return -10; } -} \ No newline at end of file +} From 5402a2b6a1b15ee1da440277ed1abf2672dffa06 Mon Sep 17 00:00:00 2001 From: Bruno Ferme Gasparin Date: Wed, 25 Oct 2017 11:45:16 -0200 Subject: [PATCH 2/2] Fixed for twig 1.25 --- lib/TwigStack/NodeVisitor/StackNodeVisitor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php index bbfae04..2d3ae4c 100644 --- a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php +++ b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php @@ -54,7 +54,7 @@ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) */ private function handleModuleNode(\Twig_Node_Module $node) { - if ($node->hasNode('body') && ! $node->hasNode('parent')) { + if ($node->hasNode('body') && (!$node->hasNode('parent') || null === $node->getNode('parent'))) { $body = $node->getNode('body'); $node->setNode('body', new StackBodyNode($body)); }