Skip to content

Skip node_modules directory when finding source files - #63

Merged
TomasVotruba merged 2 commits into
mainfrom
skip-node-modules-in-paths
Aug 11, 2026
Merged

Skip node_modules directory when finding source files#63
TomasVotruba merged 2 commits into
mainfrom
skip-node-modules-in-paths

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

node_modules is now excluded from the source finder, same as /vendor/. Projects with JS assets no longer get PHP files inside node_modules (bundled tooling, fixtures shipped in npm packages) checked.

 $finder = Finder::create()
     ->files()
     ->ignoreDotFiles(false)
     ->name($normalizedFileExtensions)
     ->in($directory)
-    ->exclude('vendor')
+    ->exclude(['vendor', 'node_modules'])

Before:

src/SomeClass.php
node_modules/some-package/fixtures/Broken.php   <-- reported errors

After:

src/SomeClass.php

Covered by a fixture in tests/Finder/SourceFinderSource/Source/node_modules/ plus an assertion in SourceFinderTest.

…ixes

type-coverage 2.3 bundles Rector\TypePerfect, so requiring rector/type-perfect separately registered MethodNodeAnalyser twice and crashed PHPStan boot.
@TomasVotruba
TomasVotruba merged commit 84e77b8 into main Aug 11, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the skip-node-modules-in-paths branch August 11, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant