Skip to content

Commit ab34891

Browse files
committed
do not add child nodes to EmptyNode instances
1 parent 85419bc commit ab34891

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy