diff --git a/src/TreeAnalyzer.php b/src/TreeAnalyzer.php index 76955c8..08c60b0 100644 --- a/src/TreeAnalyzer.php +++ b/src/TreeAnalyzer.php @@ -156,11 +156,17 @@ class TreeAnalyzer $this->collectDefinitionsAndReferences($node); } - public function getDiagnostics() + /** + * @return Diagnostic[] + */ + public function getDiagnostics(): array { return $this->diagnostics ?? []; } + /** + * @return void + */ private function addReference(string $fqn, Node $node) { if (!isset($this->referenceNodes[$fqn])) { @@ -169,21 +175,33 @@ class TreeAnalyzer $this->referenceNodes[$fqn][] = $node; } + /** + * @return Definition + */ public function getDefinitions() { return $this->definitions ?? []; } + /** + * @return Node[] + */ public function getDefinitionNodes() { return $this->definitionNodes ?? []; } + /** + * @return Node[] + */ public function getReferenceNodes() { return $this->referenceNodes ?? []; } + /** + * @return Node[] + */ public function getStmts() { return $this->stmts; diff --git a/tests/NodeVisitor/DefinitionCollectorTest.php b/tests/NodeVisitor/DefinitionCollectorTest.php index 604f30d..a092b62 100644 --- a/tests/NodeVisitor/DefinitionCollectorTest.php +++ b/tests/NodeVisitor/DefinitionCollectorTest.php @@ -68,7 +68,7 @@ class DefinitionCollectorTest extends TestCase /** * @param $path */ - private function collectDefinitions($path): array + private function collectDefinitions(string $path): array { $uri = pathToUri($path); $parser = new PhpParser\Parser();