public function skipToLeaves(TreeVisitor $visitor): void
    {
        $leaves = $this->gatherLeaves();

        foreach ($leaves as $leaf) {
            $leaf->accept($visitor);
        }
    }
public function skipToLeaves(TreeVisitor $visitor): void
    {
        $leaves = $this->gatherLeaves();

        foreach ($leaves as $leaf) {
            $leaf->accept($visitor);
        }
    }
public function skipToLeaves ( TreeVisitor $ visitor ) : void { $ leaves = $ this -> gatherLeaves ( ) ; foreach ( $ leaves as $ leaf ) { $ leaf -> accept ( $ visitor ) ; } }
Sends the visitor to the tree leaves, skipping all intermediate nodes.

@param TreeVisitor $visitor
Sends the visitor to the tree leaves skipping all intermediate nodes .