8000 bug #58964 [TwigBridge] do not add child nodes to EmptyNode instances… · symfony/symfony@8840b71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8840b71

Browse files
committed
bug #58964 [TwigBridge] do not add child nodes to EmptyNode instances (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [TwigBridge] do not add child nodes to EmptyNode instances | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT see twigphp/Twig#4465 Commits ------- ab34891 do not add child nodes to EmptyNode instances
2 parents 85419bc + ab34891 commit 8840b71

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bridge\Twig\Node\TransNode;
1616
use Twig\Environment;
1717
use Twig\Node\BlockNode;
18+
use Twig\Node\EmptyNode;
1819
use Twig\Node\Expression\ArrayExpression;
1920
use Twig\Node\Expression\AssignNameExpression;
2021
use Twig\Node\Expression\ConstantExpression;
@@ -70,6 +71,12 @@ public function enterNode(Node $node, Environment $env): Node
7071

7172
if ($node instanceof FilterExpression && 'trans' === ($node->hasAttribute('twig_callable') ? $node->getAttribute('twig_callable')->getName() : $node->getNode('filter')->getAttribute('value'))) {
7273
$arguments = $node->getNode('arguments');
74+
75+
if ($arguments instanceof EmptyNode) {
76+
$arguments = new Nodes();
77+
$node->setNode('arguments', $arguments);
78+
}
79+
7380
if ($this->isNamedArguments($arguments)) {
7481
if (!$arguments->hasNode('domain') && !$arguments->hasNode(1)) {
7582
$arguments->setNode('domain', $this->scope->get('domain'));

0 commit comments

Comments
 (0)
0