| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of Twig. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
namespace ElementorDeps\Twig\NodeVisitor; |
| 12 |
|
| 13 |
use ElementorDeps\Twig\Environment; |
| 14 |
use ElementorDeps\Twig\Node\Node; |
| 15 |
/** |
| 16 |
* Used to make node visitors compatible with Twig 1.x and 2.x. |
| 17 |
* |
| 18 |
* @author Fabien Potencier <fabien@symfony.com> |
| 19 |
* |
| 20 |
* @deprecated since 3.9 (to be removed in 4.0) |
| 21 |
*/ |
| 22 |
abstract class AbstractNodeVisitor implements NodeVisitorInterface |
| 23 |
{ |
| 24 |
public final function enterNode(Node $node, Environment $env) : Node |
| 25 |
{ |
| 26 |
return $this->doEnterNode($node, $env); |
| 27 |
} |
| 28 |
public final function leaveNode(Node $node, Environment $env) : ?Node |
| 29 |
{ |
| 30 |
return $this->doLeaveNode($node, $env); |
| 31 |
} |
| 32 |
/** |
| 33 |
* Called before child nodes are visited. |
| 34 |
* |
| 35 |
* @return Node The modified node |
| 36 |
*/ |
| 37 |
protected abstract function doEnterNode(Node $node, Environment $env); |
| 38 |
/** |
| 39 |
* Called after child nodes are visited. |
| 40 |
* |
| 41 |
* @return Node|null The modified node or null if the node must be removed |
| 42 |
*/ |
| 43 |
protected abstract function doLeaveNode(Node $node, Environment $env); |
| 44 |
} |
| 45 |
|