Repository navigation
Build/Test Tools: Update PHPStan to 2.3.6 and the PHPUnit extension to 2.1.2 - #16042
westonruter wants to merge 2 commits into
Conversation
When only part of the project is analyzed, such as a single directory or a list of files, PHPStan 2.3.6 no longer reports `ignoreErrors` entries as unmatched merely because what they ignore lies outside the analysis. The result cache also now tracks the symbols each file looked up, rather than reanalyzing every file with errors on each run. The release adds full support for PHP 8.6 and float range types, along with many fixes to type narrowing. The baselines are regenerated for what the update changes in the analysis: three `variable.undefined` errors are no longer reported, the message of an `offsetAccess.notFound` error now names the range of the offset, and the two `assign.propertyType` errors for `WP_Query::$posts` are each reported for a second assignment as well. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tnky3Grhn8Rv7MidzhrtXU Claude-Code-Session-Id: d102d8d5-ffa7-4c14-add5-1e05d41fe751
The extension now narrows types after `assertGreaterThan()` and `assertLessThan()`, and reports a data provider that provides no data sets. Neither changes what PHPStan reports for core, so the baselines are unchanged. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tnky3Grhn8Rv7MidzhrtXU Claude-Code-Session-Id: d102d8d5-ffa7-4c14-add5-1e05d41fe751
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified, and the changes are limited to the PHPStan toolchain upgrade and corresponding regenerated baseline adjustments.
No open issues 🎉
What changed in this PR
Updates WordPress core’s PHPStan tooling to PHPStan 2.3.6 and the PHPUnit extension 2.1.2, with regenerated static-analysis baselines for diagnostics changed by the upgrade.
Changes:
- Updates the pinned PHPStan and PHPStan PHPUnit extension versions.
- Removes obsolete undefined-variable baseline entries.
- Adjusts baseline messages and occurrence counts for revised PHPStan diagnostics.
| File | Description |
|---|---|
| tests/phpstan/baselines/variable.undefined.neon | Removes undefined-variable suppressions that are no longer reported by PHPStan 2.3.6. |
| tests/phpstan/baselines/offsetAccess.notFound.neon | Updates the diagnostic message to reflect PHPStan’s refined float-range output. |
| tests/phpstan/baselines/assign.propertyType.neon | Adjusts occurrence counts for additional assignments reported by PHPStan. |
| composer.json | Updates the PHPStan and PHPStan PHPUnit extension development dependencies. |
Review effort: Lite
This also updates `phpstan/phpstan-phpunit` to 2.1.2, and regenerates the baselines for the errors PHPStan now reports differently. Developed in #16042. Follow-up to r65078, r65310. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65537 602fd350-edb4-49c9-b593-d223f7449a82
This also updates `phpstan/phpstan-phpunit` to 2.1.2, and regenerates the baselines for the errors PHPStan now reports differently. Developed in WordPress/wordpress-develop#16042. Follow-up to r65078, r65310. See #65817. Built from https://develop.svn.wordpress.org/trunk@65537 git-svn-id: http://core.svn.wordpress.org/trunk@64610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
✅ Committed in r65537 (55885f6).
Updates PHPStan and its extensions to their latest releases:
phpstan/phpstan2.3.5 → 2.3.6float<0, 1.5>,finite-float, andpositive-float.ignoreErrorsentries for code outside the analysis are no longer reported as unmatched.isset(),count(),match (true)), fixes to inline@phpstan-ignorecomments in traits, and speedups such as baseline matching in time linear in the baseline's size.variable.undefinederrors are no longer reported, the message of anoffsetAccess.notFounderror now names the range of the offset, and the twoassign.propertyTypeerrors forWP_Query::$postsare each reported for a second assignment as well. Those are the??=assignments inWP_Query::get_posts()for the'ids'and'id=>parent'fields, which PHPStan now checks by the type of the right-hand side alone rather than of the whole expression (Pass only the right-hand side of??=as the written expression toPropertyAssignNodeandVariableAssignNodephpstan/phpstan-src#6943).phpstan/phpstan-phpunit2.1.1 → 2.1.2assertGreaterThan()andassertLessThan().phpstan/phpstan-strict-rulesstays at 2.1.1, which is already the latest.This is split out of #16021, which relies on PHPStan 2.3.6.
Companion Gutenberg PR: WordPress/gutenberg#86922
Trac ticket: https://core.trac.wordpress.org/ticket/65817
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5 (medium effort)
Used for: Updating the dependencies, regenerating and checking the baselines, and drafting this description; directed and reviewed by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.