15
15
use Twig \Environment ;
16
16
use Twig \Node \Expression \ArrayExpression ;
17
17
use Twig \Node \Expression \Binary \EqualBinary ;
18
- use Twig \Node \Expression \ConditionalExpression ;
19
18
use Twig \Node \Expression \ConstantExpression ;
20
19
use Twig \Node \Expression \FilterExpression ;
20
+ use Twig \Node \Expression \Ternary \ConditionalTernary ;
21
21
use Twig \Node \Node ;
22
- use Twig \NodeVisitor \AbstractNodeVisitor ;
22
+ use Twig \NodeVisitor \NodeVisitorInterface ;
23
23
24
24
/**
25
25
* Applies the value of the "desc" filter if the "trans" filter has no
29
29
*
30
30
* @author Johannes M. Schmitt <[email protected] >
31
31
*/
32
- final class DefaultApplyingNodeVisitor extends AbstractNodeVisitor
32
+ final class DefaultApplyingNodeVisitor implements NodeVisitorInterface
33
33
{
34
34
/**
35
35
* @var bool
@@ -41,7 +41,7 @@ public function setEnabled(bool $bool): void
41
41
$ this ->enabled = $ bool ;
42
42
}
43
43
44
- public function doEnterNode (Node $ node , Environment $ env ): Node
44
+ public function enterNode (Node $ node , Environment $ env ): Node
45
45
{
46
46
if (!$ this ->enabled ) {
47
47
return $ node ;
@@ -103,7 +103,7 @@ public function doEnterNode(Node $node, Environment $env): Node
103
103
);
104
104
}
105
105
106
- $ condition = new ConditionalExpression (
106
+ $ condition = new ConditionalTernary (
107
107
new EqualBinary ($ testNode , $ transNode ->getNode ('node ' ), $ wrappingNode ->getTemplateLine ()),
108
108
$ defaultNode ,
109
109
clone $ wrappingNode ,
@@ -114,7 +114,7 @@ public function doEnterNode(Node $node, Environment $env): Node
114
114
return $ node ;
115
115
}
116
116
117
- public function doLeaveNode (Node $ node , Environment $ env ): Node
117
+ public function leaveNode (Node $ node , Environment $ env ): Node
118
118
{
119
119
return $ node ;
120
120
}
0 commit comments