Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refac: fix deprecations for DefaultApplyingNodeVisitor
  • Loading branch information
gimler committed Mar 26, 2025
commit a70c38fbb03a627110a40d0d95cd3198f0780b75
12 changes: 6 additions & 6 deletions Twig/Visitor/DefaultApplyingNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
use Twig\Environment;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\Binary\EqualBinary;
use Twig\Node\Expression\ConditionalExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FilterExpression;
use Twig\Node\Expression\Ternary\ConditionalTernary;
use Twig\Node\Node;
use Twig\NodeVisitor\AbstractNodeVisitor;
use Twig\NodeVisitor\NodeVisitorInterface;

/**
* Applies the value of the "desc" filter if the "trans" filter has no
Expand All @@ -29,7 +29,7 @@
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
final class DefaultApplyingNodeVisitor extends AbstractNodeVisitor
final class DefaultApplyingNodeVisitor implements NodeVisitorInterface
{
/**
* @var bool
Expand All @@ -41,7 +41,7 @@ public function setEnabled(bool $bool): void
$this->enabled = $bool;
}

public function doEnterNode(Node $node, Environment $env): Node
public function enterNode(Node $node, Environment $env): Node
{
if (!$this->enabled) {
return $node;
Expand Down Expand Up @@ -103,7 +103,7 @@ public function doEnterNode(Node $node, Environment $env): Node
);
}

$condition = new ConditionalExpression(
$condition = new ConditionalTernary(
new EqualBinary($testNode, $transNode->getNode('node'), $wrappingNode->getTemplateLine()),
$defaultNode,
clone $wrappingNode,
Expand All @@ -114,7 +114,7 @@ public function doEnterNode(Node $node, Environment $env): Node
return $node;
}

public function doLeaveNode(Node $node, Environment $env): Node
public function leaveNode(Node $node, Environment $env): Node
{
return $node;
}
Expand Down
Loading