Repository navigation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.