Skip to content

PHPStan: Update to 2.3.7 and phpstan-strict-rules to 2.1.2 - #87323

Merged
westonruter merged 2 commits into
trunkfrom
update/phpstan-2.3.7
Nov 25, 2026
Merged

westonruter merged 2 commits into
trunkfrom
update/phpstan-2.3.7

Conversation

@westonruter

Copy link
Copy Markdown
Member

What?

See companion core PR: WordPress/wordpress-develop#16186

Updates PHPStan and its extensions to their latest releases:

  • phpstan/phpstan 2.3.6 → 2.3.7
    • A bugfix release, with no new features or configuration options.
    • Adds a throw type extension for range(), so PHPStan knows when it can throw a ValueError.
    • Fixes to type narrowing: the left side of ?? 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.
    • Keeps the literal key and value types when generalizing array shapes in loops, and keeps late-resolvable types out of array merging in TypeCombinator::union().
    • Restarts for the Tideways profiler only on PHP versions that lack its observer fix.
  • phpstan/phpstan-strict-rules 2.1.1 → 2.1.2
    • RequireParentConstructCallRule now names an anonymous class by its display name in its error.
    • StrictFunctionCallsRule is simplified without changing what it reports.
  • phpstan/phpstan-phpunit (2.1.2), phpstan/extension-installer (1.4.3), and szepeviktor/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. The WP_REST_Request offset ignores in phpstan.neon.dist stay, since the PHPStan fix they wait on (phpstan/phpstan-src#6903) is still not merged.

Testing Instructions

  1. composer update
  2. composer phpstan: both the default and strict analyses report no errors.
  3. composer phpstan:baselines: tools/phpstan/baseline.neon and tools/phpstan/baseline-strict.neon are 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.

westonruter and others added 2 commits November 23, 2026 14:20
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
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric c75cee6 trunk % Change
timeToFirstByte 51.8 ms +4.25% -2.03% 51.45 ms +3.69% -1.46% 0.68%
largestContentfulPaint 84 ms +9.52% -4.76% 80 ms +10% -0% 5%
lcpMinusTtfb 32.05 ms +14.82% -8.11% 29.25 ms +30.09% -4.1% 9.57%
wpBeforeTemplate 26 ms +7.23% -2.92% 25.49 ms +3.06% -2.12% 2%
wpTemplate 21.71 ms +4.24% -2.49% 21.68 ms +5.4% -4.06% 0.14%
wpTotal 47.73 ms +3.86% -2.12% 47.49 ms +3.41% -2.11% 0.51%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric c75cee6 trunk % Change
timeToFirstByte 43.35 ms +1.61% -3.58% 42.9 ms +3.96% -1.98% 1.05%
largestContentfulPaint 80 ms +2.5% -5% 80 ms +0% -5% 0%
lcpMinusTtfb 36.35 ms +4.13% -2.06% 35.35 ms +4.95% -2.97% 2.83%
wpBeforeTemplate 22.71 ms +3.08% -2.29% 22.56 ms +3.59% -2.35% 0.66%
wpTemplate 16.58 ms +5.49% -3.08% 16.35 ms +1.96% -1.47% 1.41%
wpTotal 40.05 ms +1.47% -3.95% 39.25 ms +4.15% -1.58% 2.04%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric c75cee6 trunk % Change
mediaProcessingJpeg 405.16 ms +1.18% -0.5% 407.78 ms +0.53% -0.7% -0.64%
mediaProcessingAvif 5930.39 ms +0.46% -0.51% 5923.64 ms +0.17% -0.3% 0.11%
mediaProcessingJpegToAvif 4031.58 ms +0.17% -0.26% 4034.49 ms +0.24% -0.17% -0.07%

media-upload

Metric c75cee6 trunk % Change
jpegUploadProcessing 1976.6 ms +1.02% -22.5% 1520.13 ms +1.97% -1.57% 30.03%
pngUploadProcessing 267.39 ms +4.94% -0.66% 268.6 ms +1.68% -1.6% -0.45%
largeJpegUploadProcessing 1512.63 ms +1.64% -0.92% 1511.99 ms +0.9% -2.11% 0.04%
multipleImageUploadProcessing 2088.01 ms +0.23% -0.5% 2082.51 ms +2.42% -1.06% 0.26%

post-editor

Metric c75cee6 trunk % Change
serverResponse 482.75 ms +3.69% -8.6% 466.58 ms +5.28% -4.57% 3.47%
firstPaint 445.17 ms +6.57% -15.03% 440.58 ms +4.97% -4.68% 1.04%
domContentLoaded 819.04 ms +12.63% -0.48% 829.59 ms +3.46% -0.95% -1.27%
loaded 820.15 ms +12.64% -0.49% 830.66 ms +3.47% -0.94% -1.27%
firstContentfulPaint 465.59 ms +15.52% -1.9% 464.42 ms +5.52% -2.04% 0.25%
firstBlock 2246.28 ms +5.12% -0.73% 2230.59 ms +2.2% -0.23% 0.7%
type 16.19 ms +8.4% -4.57% 16.48 ms +7.34% -6.25% -1.76%
typeWithoutInspector 16.02 ms +6.87% -5.06% 16.71 ms +5.39% -6.88% -4.13%
typeWithTopToolbar 22.09 ms +3.03% -6.25% 22.26 ms +5.26% -7.32% -0.76%
typeContainer 8.2 ms +4.63% -11.22% 8.32 ms +3.12% -12.98% -1.44%
focus 110.88 ms +5.83% -4.27% 108.09 ms +4.84% -7.65% 2.58%
firstFocus 293.95 ms +0% -0% 276.86 ms +0% -0% 6.17%
selectAll 406.25 ms +0.26% -3.25% 383.59 ms +6.34% -2.02% 5.91%
undo 28.8 ms +6.15% -1.84% 29.47 ms +8.21% -5.9% -2.27%
listViewOpen 64.7 ms +18.39% -7.34% 63.37 ms +4.94% -5.49% 2.1%
inserterOpen 39.36 ms +13.85% -1.45% 41.38 ms +3.77% -9.26% -4.88%
inserterHover 11.92 ms +5.45% -7.89% 10.6 ms +11.04% -5.85% 12.45%
inserterSearch 8.79 ms +3.19% -8.76% 7.64 ms +16.36% -4.71% 15.05%
loadPatterns 666.15 ms +6.75% -3.75% 627.41 ms +6.04% -4.48% 6.17%
wpTotal 472.33 ms +3.45% -8.74% 456.91 ms +5.41% -4.66% 3.37%
wpMemoryUsage 14.81 MB +0% -0% 14.76 MB +0% -0% 0.33%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric c75cee6 trunk % Change
serverResponse 393.66 ms +4.11% -4.35% 407.73 ms +1.49% -7.22% -3.45%
firstPaint 418.17 ms +9.87% -2.31% 442.36 ms +8.91% -5.52% -5.47%
domContentLoaded 849.49 ms +3.94% -1.62% 855.38 ms +1.2% -1.17% -0.69%
loaded 850.57 ms +3.96% -1.6% 856.37 ms +1.21% -1.11% -0.68%
firstContentfulPaint 473.76 ms +7.2% -3.02% 480.42 ms +1.43% -1.69% -1.39%
firstBlock 2548.01 ms +2.72% -1.34% 2529.96 ms +0.84% -0.78% 0.71%
type 21.45 ms +12.96% -10.82% 19.94 ms +2.31% -12.49% 7.57%
navigate 119.6 ms +4.41% -1.87% 113.64 ms +7.1% -4.44% 5.24%
loadPatterns 1423.77 ms +8.79% -5.31% 1428.88 ms +6.6% -12.69% -0.36%
loadPages 948.97 ms +1.1% -1.69% 943.61 ms +0.81% -1.72% 0.57%
wpTotal 383.73 ms +4.22% -4.59% 397.84 ms +1.43% -7.39% -3.55%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

291d462 Run

@westonruter
westonruter marked this pull request as ready for review November 24, 2026 07:04
@westonruter
westonruter merged commit beb5f63 into trunk Nov 25, 2026
109 checks passed
@westonruter
westonruter deleted the update/phpstan-2.3.7 branch November 25, 2026 07:44
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants