Repository navigation
feat(phpstan): run shared baseline at level 8 - #83
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PHP version upper bound excludes PHP 8.5 patch releases after 8.5.0, which can produce incorrect analysis of version-dependent branches.
1 open issue
What changed in this PR
Raises the shared rtcamp/wp-phpstan baseline to level 8 and sets an explicit PHP analysis range for consistent checks across consumer projects.
Changes:
- Enables stricter type and nullable-access checks with a PHP 8.2–8.5 target range.
- Raises PHPStan requirements to
^2.3and updates the root lockfile. - Adds regression fixtures and tests, and updates usage and migration documentation.
| File | Description |
|---|---|
monorepo-builder.php |
Aligns generated development requirements with PHPStan ^2.3. |
composer.lock |
Locks PHPStan to 2.3.1. |
composer.json |
Raises the root PHPStan requirement. |
composer-packages/phpstan/tests/fixtures/typed-constant.php |
Adds syntax requiring PHP 8.3 to test the 8.2 floor. |
composer-packages/phpstan/tests/fixtures/nullable.php |
Adds nullable property access to test level 8. |
composer-packages/phpstan/tests/ConfigTest.php |
Tests stricter defaults in an isolated consumer project. |
composer-packages/phpstan/README.md |
Documents new defaults and revises example analysis paths. |
composer-packages/phpstan/phpstan.neon.dist |
Sets level 8 and explicit PHP version bounds. |
composer-packages/phpstan/composer.json |
Requires PHPStan ^2.3 for consumers. |
composer-packages/phpstan/CHANGELOG.md |
Records stricter checks, version targeting, and migration guidance. |
Review effort: Balanced
ec2cbac to
d658432
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

What this PR does
Bumps rtCamp's shared PHPStan baseline (
rtcamp/wp-phpstan) from level 5 to level 8 and pins the analysis to the rtCamp PHP range (8.2–8.5), so every WordPress project extending this baseline gets the same, stricter, and — for the first time — deterministic set of errors regardless of which PHP its CI runs on.Closes
N/A
Changes
phpstan.neon.dist. Consumers now also get level 6 (missing types on params, returns, properties, array values), level 7 (partially wrong union types), and level 8 (method calls and property access on nullable types).phpVersion: 80200–80599. Analysis no longer follows whatever PHP the machine orcomposer.jsonimplies: code is checked against the 8.2 floor (8.3+ syntax such as typed class constants is rejected), while 8.3–8.5 symbols stay known. Consumers can override it.phpstan/phpstanraised to^2.3for its rewritten, faster engine. The root dev tooling and monorepo-builder's appendedrequire-devmove to^2.3with it.WP_Postaccess) and the 8.2 floor (a typed class constant).How I verified
❯ composer test PHPUnit 11.5.57 by Sebastian Bergmann and contributors. Runtime: PHP 8.5.9 Configuration: /Users/adi/rtproj/wp-tooling-phpstan-level-8/composer-packages/phpstan/phpunit.xml.dist .... 4 / 4 (100%) Time: 00:06.929, Memory: 8.00 MB OK (4 tests, 43 assertions)CI runs the same suite on PHP 8.2, 8.3 and 8.4.
Acceptance criteria
Runtime behavior
Code quality
Housekeeping
CHANGELOG.mdentry under## UnreleasedReviewer notes
lint/phpstanscaffold, whose generated config listssrcandincludesand so failscomposer analysein any project without both.rtcamp/wp-phpstan ^2.0follows the release tag.