diff --git a/.gitmodules b/.gitmodules index 3f59547..81bcac1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "validation/frameworks/drupal"] path = validation/frameworks/drupal url = https://github.com/drupal/drupal +[submodule "validation/frameworks/tolerant-php-parser"] + path = validation/frameworks/tolerant-php-parser + url = https://github.com/microsoft/tolerant-php-parser diff --git a/src/PhpDocument.php b/src/PhpDocument.php index 23387f5..4ccedf3 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -229,9 +229,9 @@ class PhpDocument /** * Returns the AST of the document * - * @return Node[] + * @return Node[] | Tolerant\Node | null */ - public function getStmts(): array + public function getStmts() { return $this->stmts; } diff --git a/tests/Validation/ValidationTest.php b/tests/Validation/ValidationTest.php index 1be9e69..b3f829e 100644 --- a/tests/Validation/ValidationTest.php +++ b/tests/Validation/ValidationTest.php @@ -30,7 +30,7 @@ class ValidationTest extends TestCase foreach (new RecursiveIteratorIterator($iterator) as $file) { if (strpos((string)$file, ".php") !== false) { - if ($file->getSize() < 100000 ) { + if ($file->getSize() < 100000) { $testProviderArray[$frameworkName . "::" . $file->getBasename()] = [$file->getPathname(), $frameworkName]; } } @@ -69,6 +69,8 @@ class ValidationTest extends TestCase $this->fail((string)$e); } + $this->assertNotNull($document->getStmts()); + if (file_exists($outFile)) { unlink($outFile); }