/** * The actual testing method */ public function run() { /** @var XHPASTNode $root_node */ $root_node = $this->input->getRootNode(); /** @var AASTNodeList $classes */ $classes = $root_node->selectDescendantsOfType('n_CLASS_DECLARATION'); $class_symbols = array(); foreach ($classes as $class_node) { /** @var XHPASTNode $class_node */ $class_symbols[] = $class_node->getStringLiteralValue(); } $this->result = $class_symbols; $this->success = count($this->result) < 2; }
public static function newFromTree(XHPASTTree $tree) { $obj = new XHPASTNodeList(); $obj->tree = $tree; $obj->list = array(0 => $tree->getRootNode()); $obj->ids = array(0 => 0); return $obj; }
/** * The actual testing method */ public function run() { /** @var XHPASTNode $root_node */ $root_node = $this->input->getRootNode(); /** @var AASTNodeList $node */ $nodes = $root_node->selectDescendantsOfType('n_STATEMENT'); if ($nodes->count()) { $nodes->rewind(); /** @var XHPASTNode $node */ $node = $nodes->current(); $node_string = $node->getConcreteString(); if (strtolower(substr($node_string, 0, 5)) !== 'defin') { $this->result = $node_string; $this->success = false; } $this->result = $node_string; } }