Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractNodeVisitor.php

class AbstractNodeVisitor

Same name in this branch
  1. 11.1.x vendor/phpstan/phpdoc-parser/src/Ast/AbstractNodeVisitor.php \PHPStan\PhpDocParser\Ast\AbstractNodeVisitor

Used to make node visitors compatible with Twig 1.x and 2.x.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

  • class \Twig\NodeVisitor\AbstractNodeVisitor implements \Twig\NodeVisitor\NodeVisitorInterface

Expanded class hierarchy of AbstractNodeVisitor

Deprecated

since 3.9 (to be removed in 4.0)

File

vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php, line 24

Namespace

Twig\NodeVisitor
View source
abstract class AbstractNodeVisitor implements NodeVisitorInterface {
    public final function enterNode(Node $node, Environment $env) : Node {
        return $this->doEnterNode($node, $env);
    }
    public final function leaveNode(Node $node, Environment $env) : ?Node {
        return $this->doLeaveNode($node, $env);
    }
    
    /**
     * Called before child nodes are visited.
     *
     * @return Node The modified node
     */
    protected abstract function doEnterNode(Node $node, Environment $env);
    
    /**
     * Called after child nodes are visited.
     *
     * @return Node|null The modified node or null if the node must be removed
     */
    protected abstract function doLeaveNode(Node $node, Environment $env);

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AbstractNodeVisitor::doEnterNode abstract protected function Called before child nodes are visited.
AbstractNodeVisitor::doLeaveNode abstract protected function Called after child nodes are visited.
AbstractNodeVisitor::enterNode final public function Called before child nodes are visited. Overrides NodeVisitorInterface::enterNode
AbstractNodeVisitor::leaveNode final public function Called after child nodes are visited. Overrides NodeVisitorInterface::leaveNode
NodeVisitorInterface::getPriority public function Returns the priority for this visitor. 10
RSS feed
Powered by Drupal