Script to reproduce:
<?php require __DIR__.'/scripts/__init_script__.php'; $input = <<<'PHP' <?php class Test { public function one() { } abstract function two() { } static function three() { } } PHP; $tree = XHPASTTree::newFromData($input); $root = $tree->getRootNode(); $methods = $root->selectDescendantsOfType('n_METHOD_DECLARATION'); foreach ($methods as $method) { echo $method->getConcreteString()."\n"; }
Expected output:
public function one() { } abstract function two() { } static function three() { }
Actual output:
function one() { } function two() { } function three() { }