Repository navigation
PHPStan: Update to 2.3.7 and phpstan-strict-rules to 2.1.2 - #87323
Merged
Merged
Conversation
PHPStan 2.3.7 is a bugfix release: it adds a throw type extension for `range()`, fixes several cases of type narrowing (the left side of `??`, ternary arms, and conditional types), and keeps literal key and value types when generalizing array shapes in loops. The analysis still reports no errors, and no ignore goes stale, so the baseline is unchanged. The `WP_REST_Request` offset ignores stay, since the PHPStan fix they wait on (phpstan/phpstan-src#6903) is not yet merged. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Code-Session-Id: 6039515b-ba87-4f51-93df-97ff03a73533
The extension now names an anonymous class by its display name in the error for a constructor that does not call its parent's, and simplifies the rule for strict function calls without changing what it reports. Neither changes what the analysis reports, so the baseline is unchanged. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Code-Session-Id: 6039515b-ba87-4f51-93df-97ff03a73533
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. 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:
Updated as activity occurs, without notifying anyone named here. Add the ⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
westonruter
marked this pull request as ready for review
November 24, 2026 07:04
swissspidy
approved these changes
Nov 25, 2026
Vedant-Gandhi
pushed a commit
to Vedant-Gandhi/gutenberg
that referenced
this pull request
Nov 30, 2026
…#87323) * PHPStan: Update to 2.3.7 PHPStan 2.3.7 is a bugfix release: it adds a throw type extension for `range()`, fixes several cases of type narrowing (the left side of `??`, ternary arms, and conditional types), and keeps literal key and value types when generalizing array shapes in loops. The analysis still reports no errors, and no ignore goes stale, so the baseline is unchanged. The `WP_REST_Request` offset ignores stay, since the PHPStan fix they wait on (phpstan/phpstan-src#6903) is not yet merged. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> * PHPStan: Update phpstan-strict-rules to 2.1.2 The extension now names an anonymous class by its display name in the error for a constructor that does not call its parent's, and simplifies the rule for strict function calls without changing what it reports. Neither changes what the analysis reports, so the baseline is unchanged. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> --------- Co-authored-by: westonruter <westonruter@git.wordpress.org> Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
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?
See companion core PR: WordPress/wordpress-develop#16186
Updates PHPStan and its extensions to their latest releases:
phpstan/phpstan2.3.6 → 2.3.7range(), so PHPStan knows when it can throw aValueError.??is narrowed to non-null when a comparison rules out the right side, ternary arms are only recorded as conditional expressions when they are disjoint, and two conditional types are compared branch by branch only when they share the same condition.TypeCombinator::union().phpstan/phpstan-strict-rules2.1.1 → 2.1.2RequireParentConstructCallRulenow names an anonymous class by its display name in its error.StrictFunctionCallsRuleis simplified without changing what it reports.phpstan/phpstan-phpunit(2.1.2),phpstan/extension-installer(1.4.3), andszepeviktor/phpstan-wordpress(2.0.4) are already at their latest versions.Why?
To keep Gutenberg's PHPStan setup in step with core's, which is being updated to the same versions in the companion PR, and to pick up the type-narrowing fixes.
How?
Bumps the two versions in
composer.json, one commit each. Neither update changes what the analysis reports for Gutenberg, so both baselines are unchanged. TheWP_REST_Requestoffset ignores inphpstan.neon.diststay, since the PHPStan fix they wait on (phpstan/phpstan-src#6903) is still not merged.Testing Instructions
composer updatecomposer phpstan: both the default and strict analyses report no errors.composer phpstan:baselines:tools/phpstan/baseline.neonandtools/phpstan/baseline-strict.neonare unchanged.Testing Instructions for Keyboard
N/A, no UI changes.
Screenshots or screencast
N/A
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5 (medium effort)
Used for: Updating the dependencies, checking the analysis and baselines, and drafting this description; directed and reviewed by me.