Skip to content

Commit ceb1dbc

Browse files
committed
refac: filter use attribute instate of node
1 parent 1fddbb6 commit ceb1dbc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Twig/Visitor/DefaultApplyingNodeVisitor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public function enterNode(Node $node, Environment $env): Node
4747
return $node;
4848
}
4949

50-
if (!($node instanceof FilterExpression && 'desc' === $node->getNode('filter')->getAttribute('value'))) {
50+
if (!($node instanceof FilterExpression && 'desc' === $node->getAttribute('twig_callable')->getName())) {
5151
return $node;
5252
}
5353

5454
$transNode = $node->getNode('node');
5555
while ($transNode instanceof FilterExpression
56-
&& 'trans' !== $transNode->getNode('filter')->getAttribute('value')
57-
&& 'transchoice' !== $transNode->getNode('filter')->getAttribute('value')) {
56+
&& 'trans' !== $transNode->getAttribute('twig_callable')->getName()
57+
&& 'transchoice' !== $transNode->getAttribute('twig_callable')->getName()) {
5858
$transNode = $transNode->getNode('node');
5959
}
6060

@@ -69,7 +69,7 @@ public function enterNode(Node $node, Environment $env): Node
6969
// if the |transchoice filter is used, delegate the call to the TranslationExtension
7070
// so that we can catch a possible exception when the default translation has not yet
7171
// been extracted
72-
if ('transchoice' === $transNode->getNode('filter')->getAttribute('value')) {
72+
if ('transchoice' === $transNode->getAttribute('twig_callable')->getName()) {
7373
$transchoiceArguments = new ArrayExpression([], $transNode->getTemplateLine());
7474
$transchoiceArguments->addElement($wrappingNode->getNode('node'));
7575
$transchoiceArguments->addElement($defaultNode);

0 commit comments

Comments
 (0)