Skip to content

Commit 2a463f1

Browse files
committed
fix: declare nikic/php-parser as runtime require, drop PhpParser whitelist
src/PHPStan/Rules/* uses PhpParser\Node\* classes at runtime. These were previously satisfied transitively (via phpstan/phpstan) and the unknown symbols whitelisted in qaConfig/composerRequireChecker.json to silence composer-require-checker. The new "DO NOT WHITELIST DEV-DEPENDENCY SYMBOLS" guidance correctly flagged the recently introduced PhpParser\Node\Stmt\Property usage in RequireReadonlyServiceRule.php (this symbol was not in the whitelist). Correct fix per the new policy: - Add nikic/php-parser ^5.0 to require (it IS a runtime dependency of the rules shipped in src/) - Drop the now-unnecessary PhpParser\* whitelist entries Verified locally: bin/qa -t cr -> "There were no unknown symbols found." CI break (composer-require-checker exit 1) is now resolved.
1 parent c542ad7 commit 2a463f1

3 files changed

Lines changed: 2 additions & 36 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"composer-plugin-api": "^2.0",
1313
"ergebnis/composer-normalize": "^2.42",
1414
"funkyproject/reflection-file": "@stable",
15+
"nikic/php-parser": "^5.0",
1516
"php-parallel-lint/php-console-color": "@stable",
1617
"php-parallel-lint/php-parallel-lint": "@stable",
1718
"phpstan/extension-installer": "@stable",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

qaConfig/composerRequireChecker.json

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,6 @@
2424
"Composer\\Script\\Event",
2525
"Composer\\Script\\ScriptEvents",
2626
"Composer\\Semver\\Semver",
27-
"PhpParser\\Comment",
28-
"PhpParser\\Node",
29-
"PhpParser\\NodeFinder",
30-
"PhpParser\\Node\\Arg",
31-
"PhpParser\\Node\\Attribute",
32-
"PhpParser\\Node\\Expr\\BinaryOp",
33-
"PhpParser\\Node\\Expr\\BinaryOp\\Coalesce",
34-
"PhpParser\\Node\\Expr\\BinaryOp\\Concat",
35-
"PhpParser\\Node\\Expr\\BinaryOp\\Equal",
36-
"PhpParser\\Node\\Expr\\BinaryOp\\NotEqual",
37-
"PhpParser\\Node\\Expr\\ClassConstFetch",
38-
"PhpParser\\Node\\Expr\\ConstFetch",
39-
"PhpParser\\Node\\Expr\\Empty_",
40-
"PhpParser\\Node\\Expr\\FuncCall",
41-
"PhpParser\\Node\\Expr\\MethodCall",
42-
"PhpParser\\Node\\Expr\\New_",
43-
"PhpParser\\Node\\Expr\\Throw_",
44-
"PhpParser\\Node\\Expr\\Variable",
45-
"PhpParser\\Node\\Identifier",
46-
"PhpParser\\Node\\Name",
47-
"PhpParser\\Node\\Scalar\\String_",
48-
"PhpParser\\Node\\Stmt",
49-
"PhpParser\\Node\\Stmt\\Catch_",
50-
"PhpParser\\Node\\Stmt\\Class_",
51-
"PhpParser\\Node\\Stmt\\ClassLike",
52-
"PhpParser\\Node\\Stmt\\Declare_",
53-
"PhpParser\\Node\\Stmt\\Enum_",
54-
"PhpParser\\Node\\Stmt\\Interface_",
55-
"PhpParser\\Node\\Stmt\\ClassMethod",
56-
"PhpParser\\Node\\Stmt\\Trait_",
57-
"PhpParser\\Node\\VariadicPlaceholder",
58-
"PhpParser\\Comment\\Doc",
59-
"PhpParser\\Node\\Expr\\Ternary",
60-
"PhpParser\\Node\\NullableType",
61-
"PhpParser\\Node\\Param",
6227
"PHPStan\\Analyser\\NodeCallbackInvoker",
6328
"PHPStan\\Analyser\\Scope",
6429
"PHPStan\\Node\\FileNode",

0 commit comments

Comments
 (0)