getMethodByClass($astNode, 'visitEnter')) { return $method($astNode); } return TRUE; } /** * Visiting the $node element * * @param Ast\Node $astNode */ public function visit(Ast\Node $astNode): void { if ($method = $this->getMethodByClass($astNode)) { $method($astNode); } } /** * Entering an element in the ast, called after visiting children * * @param Ast\Node $astNode * @return void */ public function visitLeave(Ast\Node $astNode): void { if ($method = $this->getMethodByClass($astNode, 'visitLeave')) { $method($astNode); } } } }