diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91b4d7c3..7bc69489 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,6 +78,7 @@ jobs: matrix: os: [ubuntu-22.04] php-version: [8.1, 8.2, 8.3] + phpstan_parser: [true, false] steps: - name: "Checkout" @@ -108,5 +109,15 @@ jobs: - name: "Install dependencies with composer" run: make composer-install + - name: Configure PhpStan Parser in 'deptrac.yaml' + if: matrix.phpstan_parser == 'false' + run: | + sed -i 's/phpstan_parser: true/phpstan_parser: false/' deptrac.yaml + + - name: Configure PhpStan Parser in 'deptrac.config.php' + if: matrix.phpstan_parser == 'false' + run: | + sed -i 's/phpstanParser: true/phpstanParser: false/' deptrac.config.php + - name: "Run deptrac" run: make deptrac diff --git a/src/Core/Ast/Parser/DelegatingParser.php b/src/Core/Ast/Parser/DelegatingParser.php index 214b13b5..9aab9ea4 100644 --- a/src/Core/Ast/Parser/DelegatingParser.php +++ b/src/Core/Ast/Parser/DelegatingParser.php @@ -4,6 +4,7 @@ namespace Qossmic\Deptrac\Core\Ast\Parser; +use PhpParser\NodeTraverser; use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; use Qossmic\Deptrac\Core\Ast\Parser\PhpStanParser\PhpStanParser; @@ -17,7 +18,9 @@ public function __construct( private readonly array $featureFlags, private readonly NikicPhpParser $nikicPhpParser, private readonly PhpStanParser $phpStanParser, - ) {} + ) { + $this->traverser = new NodeTraverser(); + } protected function loadNodesFromFile(string $filepath): array {