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
12namespace Twig\NodeVisitor;
13
14use Twig\Environment;
15
16/**
17 * Interface for node visitor classes.
18 *
19 * @author Fabien Potencier <fabien@symfony.com>
20 */
21interface NodeVisitorInterface
22{
23    /**
24     * Called before child nodes are visited.
25     *
26     * @return \Twig_NodeInterface The modified node
27     */
28    public function enterNode(\Twig_NodeInterface $node, Environment $env);
29
30    /**
31     * Called after child nodes are visited.
32     *
33     * @return \Twig_NodeInterface|false The modified node or false if the node must be removed
34     */
35    public function leaveNode(\Twig_NodeInterface $node, Environment $env);
36
37    /**
38     * Returns the priority for this visitor.
39     *
40     * Priority should be between -10 and 10 (0 is the default).
41     *
42     * @return int The priority level
43     */
44    public function getPriority();
45}
46
47class_alias('Twig\NodeVisitor\NodeVisitorInterface', 'Twig_NodeVisitorInterface');
48
49// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
50class_exists('Twig\Environment');
51