Skip to content

Commit 4d5f6a4

Browse files
committed
Build/Test Tools: Exclude dependencies from PHPStan.
The bundled themes are analyzed as whole directories, so a local `npm install` in one of them puts its `node_modules` into the analysis. Some npm packages ship PHP files, such as `flatted` in Twenty Twenty, and running `composer phpstan:baselines` then recorded errors from those files in the baselines. This excludes `node_modules` directories at any depth from both analysis and symbol discovery. Composer `vendor` directories of themes and plugins under `wp-content` are excluded in the same way, while the root `vendor` directory is left alone since PHPStan resolves development dependencies from it. Follow-up to r61699. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@63938 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 50f4cdd commit 4d5f6a4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎tests/phpstan/base.neon‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ parameters:
222222
excludePaths:
223223
analyseAndScan:
224224
- ../../src/wp-admin/includes/noop.php
225+
# Locally installed npm dependencies, such as in bundled themes, which may include PHP files.
226+
- */node_modules/*
227+
# Composer dependencies of themes and plugins, which are not part of core.
228+
- ../../src/wp-content/*/vendor/*
225229
analyse:
226230
# These files are deprecated.
227231
- ../../src/wp-admin/includes/deprecated.php

0 commit comments

Comments
 (0)