]> Raphaël G. Git Repositories - packbundle/commitdiff
Replace future abstract Node with EmptyNode and Nodes
authorRaphaël Gertz <git@rapsys.eu>
Tue, 14 Oct 2025 15:01:14 +0000 (17:01 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 14 Oct 2025 15:01:14 +0000 (17:01 +0200)
Replace AssignNameExpression with AssignContextVariable

Parser/TokenParser.php

index 7d73117b432129a70fbfbfcb6f2972530846de40..a1fe4c5f5adcdb7d14c3d05ca321f3a896588e56 100644 (file)
@@ -26,8 +26,10 @@ use Symfony\Component\Routing\Exception\RouteNotFoundException;
 use Symfony\Component\Routing\RouterInterface;
 
 use Twig\Error\Error;
 use Symfony\Component\Routing\RouterInterface;
 
 use Twig\Error\Error;
-use Twig\Node\Expression\AssignNameExpression;
+use Twig\Node\Expression\Variable\AssignContextVariable;
 use Twig\Node\Node;
 use Twig\Node\Node;
+use Twig\Node\Nodes;
+use Twig\Node\EmptyNode;
 use Twig\Node\SetNode;
 use Twig\Node\TextNode;
 use Twig\Source;
 use Twig\Node\SetNode;
 use Twig\Node\TextNode;
 use Twig\Source;
@@ -245,7 +247,7 @@ class TokenParser extends AbstractTokenParser {
                        #throw new Error('Empty inputs token', $token->getLine(), $stream->getSourceContext());
 
                        //Send an empty node without inputs
                        #throw new Error('Empty inputs token', $token->getLine(), $stream->getSourceContext());
 
                        //Send an empty node without inputs
-                       return new Node();
+                       return new EmptyNode();
                }
 
                //Check filters
                }
 
                //Check filters
@@ -329,13 +331,13 @@ class TokenParser extends AbstractTokenParser {
                }
 
                //Set name in context key
                }
 
                //Set name in context key
-               $ref = new AssignNameExpression($this->token, $token->getLine());
+               $ref = new AssignContextVariable($this->token, $token->getLine());
 
                //Set output in context value
                $value = new TextNode($asset, $token->getLine());
 
                //Send body with context set
 
                //Set output in context value
                $value = new TextNode($asset, $token->getLine());
 
                //Send body with context set
-               return new Node([
+               return new Nodes([
                        //This define name in twig template by prepending $context['<name>'] = '<output>';
                        new SetNode(true, $ref, $value, $token->getLine(), $this->getTag()),
                        //The tag captured body
                        //This define name in twig template by prepending $context['<name>'] = '<output>';
                        new SetNode(true, $ref, $value, $token->getLine(), $this->getTag()),
                        //The tag captured body