ConditionVerdictAwareIncludeTreeTraverser implements IncludeTreeTraverserInterface

FinalYes

An optimized traverser that does not traverse children when a node is a condition node that evaluate false.

This is pretty clever: When adding the ConditionMatcherVisitor as first visitor, it sets the condition verdict of a ConditionInterface node in visitBeforeChildren(). Adding the AstBuilderVisitor as second visitor, the AstBuilderVisitor will not be called for ConditionInterface children that did not evaluate to true. This way, we can both evaluate conditions and build the AST in only one traversing round.

Tags
internal:

Internal tree structure.

Table of Contents

Interfaces

IncludeTreeTraverserInterface
Interface implemented by include tree traversers.

Methods

traverse()  : void

Methods

traverse()

public traverse(RootInclude $rootInclude, array<string|int, mixed> $visitors) : void
Parameters
$rootInclude : RootInclude
$visitors : array<string|int, mixed>

        
On this page

Search results