Skip to content

fix(scaffolds): mark optional excludes in the lint/phpstan config - #77

Merged
AnuragVasanwala merged 1 commit into
mainfrom
fix/phpstan-scaffold-excludes
Oct 1, 2026
Merged

AnuragVasanwala merged 1 commit into
mainfrom
fix/phpstan-scaffold-excludes

Conversation

@aryanjasala

Copy link
Copy Markdown
Member

The phpstan.neon.dist that wp-tooling add lint/phpstan generates excludes node_modules, build and tests. PHPStan treats an excluded path that does not exist as a configuration error, so composer analyse failed in any project missing one of them:

Invalid entries in excludePaths:
Path "build" is neither a directory, nor a file path, nor a fnmatch pattern.
Path "tests" is neither a directory, nor a file path, nor a fnmatch pattern.

This marks the three optional with (?). vendor stays as it is, since it always exists once PHPStan is installed.

Merge before @rtcamp/wp-tooling 2.0.0 goes to npm, so the fix ships in 2.0.0.

Testing

  • wp-tooling add lint/phpstan in an empty project renders the three excludes with (?)
  • PHPStan 2.2.1 on the rendered config passes in a project with src/ and includes/ but no node_modules/, build/ or tests/, and still reports an error planted in src/
  • npm run check: lint clean, 1,407 tests passing

PHPStan treats an excluded path that does not exist as a configuration
error, so the generated phpstan.neon.dist failed in any project without
node_modules, build or tests. Mark those three optional with (?); vendor
always exists once PHPStan is installed.
@AnuragVasanwala
AnuragVasanwala merged commit 1f44a18 into main Oct 1, 2026
11 checks passed
@Adi-ty
Adi-ty deleted the fix/phpstan-scaffold-excludes branch November 3, 2026 15:13
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.

2 participants