Skip to content

PHPStan: Update to 2.3.6 and phpstan-phpunit to 2.1.2 - #86922

Open
westonruter wants to merge 2 commits into
trunkfrom
update/phpstan
Open

westonruter wants to merge 2 commits into
trunkfrom
update/phpstan

Conversation

@westonruter

Copy link
Copy Markdown
Member

What?

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

Updates PHPStan and its extensions to their latest releases:

  • phpstan/phpstan 2.3.5 → 2.3.6
    • Full support for PHP 8.6, including partial function application.
    • Float range types, such as float<0, 1.5>, finite-float, and positive-float.
    • When only part of a project is analyzed, such as a single directory or a list of files, ignoreErrors entries for code outside the analysis are no longer reported as unmatched.
    • The result cache tracks which symbols each file looked up, so a new class or function reanalyzes only the files that asked about it, rather than every file with errors (baselined ones included).
    • Many fixes to type narrowing (loose comparisons, isset(), count(), match (true)), fixes to inline @phpstan-ignore comments in traits, and speedups such as baseline matching in time linear in the baseline's size.
  • phpstan/phpstan-phpunit 2.1.1 → 2.1.2
    • Narrows types after assertGreaterThan() and assertLessThan().
    • Reports a data provider that provides no data sets.
  • phpstan/phpstan-strict-rules (2.1.1), 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. The partial-analysis fix also means analyzing a single file or directory no longer reports unrelated ignore.unmatched errors.

How?

Bumps the two versions in composer.json, one commit each. Neither update changes what the analysis reports for Gutenberg, so the baseline is unchanged; core's baselines do change, for reasons that don't apply here (see the companion PR). The WP_REST_Request offset ignores in phpstan.neon.dist stay, since the PHPStan fix they wait on (phpstan/phpstan-src#6903) is not yet merged.

Testing Instructions

  1. composer update
  2. composer phpstan: it reports no errors.
  3. composer phpstan:baselines: tools/phpstan/baseline.neon is 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 baseline, and drafting this description; directed and reviewed by me.

westonruter and others added 2 commits November 16, 2026 15:11
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 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-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 the analysis reports, so the baseline is
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
@github-actions

github-actions Bot commented Nov 16, 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>

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 631fc13 trunk % Change
timeToFirstByte 47.65 ms +7.87% -2.73% 47.9 ms +8.25% -4.18% -0.52%
largestContentfulPaint 76 ms +13.16% -0% 78 ms +7.69% -5.13% -2.56%
lcpMinusTtfb 29 ms +13.79% -3.97% 28.1 ms +22.42% -4.63% 3.2%
wpBeforeTemplate 24.3 ms +7.82% -4.28% 23.84 ms +11.41% -2.43% 1.93%
wpTemplate 19.28 ms +7.57% -1.56% 19.65 ms +6.46% -4.58% -1.88%
wpTotal 43.82 ms +7.71% -3.61% 44.06 ms +9.01% -4.24% -0.54%
wpMemoryUsage 7.75 MB +0% -0% 7.71 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 631fc13 trunk % Change
timeToFirstByte 40.4 ms +3.84% -3.34% 39.4 ms +4.7% -1.9% 2.54%
largestContentfulPaint 76 ms +0% -0% 74 ms +5.41% -2.7% 2.7%
lcpMinusTtfb 35.6 ms +4.07% -5.9% 34.1 ms +10.41% -4.4% 4.4%
wpBeforeTemplate 21.62 ms +6.85% -1.94% 21.05 ms +5.7% -0.9% 2.71%
wpTemplate 15.12 ms +3.77% -2.45% 15.18 ms +3.75% -3.69% -0.4%
wpTotal 37.36 ms +3.43% -3.19% 36.36 ms +4.54% -1.51% 2.75%
wpMemoryUsage 6.44 MB +0% -0% 6.40 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 631fc13 trunk % Change
mediaProcessingJpeg 408.91 ms +0.48% -0.13% 408.88 ms +0.26% -0.59% 0.01%
mediaProcessingAvif 6347.56 ms +0.19% -0.27% 6345.48 ms +0.41% -0.06% 0.03%
mediaProcessingJpegToAvif 4339.48 ms +0.29% -0.15% 4364.69 ms +0.27% -0.24% -0.58%

media-upload

Metric 631fc13 trunk % Change
jpegUploadProcessing 1503.29 ms +35.92% -1.21% 1502.69 ms +0.8% -0.87% 0.04%
pngUploadProcessing 257.65 ms +2.32% -2.2% 266.76 ms +6.43% -1.75% -3.42%
largeJpegUploadProcessing 1485.13 ms +1.01% -0.46% 1494.69 ms +0.66% -0.47% -0.64%
multipleImageUploadProcessing 2061.95 ms +2.57% -20.24% 1671.93 ms +9.12% -0.37% 23.33%

post-editor

Metric 631fc13 trunk % Change
serverResponse 260.27 ms +5.39% -11.05% 253.9 ms +6.08% -5.61% 2.51%
firstPaint 276.49 ms +3.85% -7.81% 273.62 ms +7.8% -6.43% 1.05%
domContentLoaded 516.98 ms +1.13% -2.08% 528.28 ms +0.83% -0.83% -2.14%
loaded 517.9 ms +1.13% -2.11% 529.15 ms +0.85% -0.84% -2.13%
firstContentfulPaint 295.96 ms +4.14% -1.87% 300.85 ms +0.79% -1.96% -1.63%
firstBlock 1389.16 ms +2.27% -1.41% 1422.42 ms +1.14% -1% -2.34%
type 12.07 ms +8.86% -6.96% 12.79 ms +8.99% -5.47% -5.63%
typeWithoutInspector 13.09 ms +23.53% -6.42% 12.99 ms +4% -9.39% 0.77%
typeWithTopToolbar 14.39 ms +9.17% -6.32% 15.66 ms +2.43% -10.66% -8.11%
typeContainer 5.69 ms +3.34% -11.07% 5.68 ms +2.29% -11.27% 0.18%
focus 69.72 ms +13.77% -2.54% 66.44 ms +7.19% -2.59% 4.94%
firstFocus 158.2 ms +0% -0% 151.19 ms +0% -0% 4.64%
selectAll 226.7 ms +1.86% -1.02% 228.71 ms +2.23% -0.94% -0.88%
undo 17.87 ms +5.54% -5.82% 20.38 ms +7.16% -1.67% -12.32%
listViewOpen 43.98 ms +6.34% -7.14% 50.54 ms +18.86% -12.39% -12.98%
inserterOpen 26.49 ms +6.72% -4.42% 27.76 ms +8.57% -5.73% -4.57%
inserterHover 7.58 ms +12.8% -5.94% 7.82 ms +12.79% -7.03% -3.07%
inserterSearch 6.09 ms +8.37% -2.13% 6.21 ms +8.53% -2.58% -1.93%
loadPatterns 394.28 ms +5.72% -1.19% 405.59 ms +3.76% -0.71% -2.79%
wpTotal 253.52 ms +5.08% -11.3% 246.71 ms +6.52% -5.56% 2.76%
wpMemoryUsage 14.81 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 631fc13 trunk % Change
serverResponse 468.99 ms +1.07% -6.35% 490.83 ms +0.51% -7.43% -4.45%
firstPaint 444.22 ms +7.53% -9.89% 409.5 ms +7.74% -5.88% 8.48%
domContentLoaded 833.38 ms +1.19% -1.13% 824.07 ms +0.42% -0.42% 1.13%
loaded 834.6 ms +1.18% -1.17% 825.02 ms +0.4% -0.42% 1.16%
firstContentfulPaint 470.11 ms +1.61% -1.56% 461.59 ms +1.91% -1.95% 1.85%
firstBlock 2576.44 ms +1.06% -1.49% 2544.46 ms +1.48% -0.89% 1.26%
type 17.67 ms +4.87% -11.71% 17.45 ms +1.83% -8.94% 1.26%
navigate 115.55 ms +12.37% -5.56% 105.02 ms +1.96% -2.59% 10.03%
loadPatterns 1264.19 ms +8.43% -8.23% 1207 ms +10.28% -10.69% 4.74%
loadPages 931.25 ms +3.26% -1.39% 981.73 ms +1.59% -1.74% -5.14%
wpTotal 459.56 ms +1.09% -6.51% 481.36 ms +0.5% -7.65% -4.53%
wpMemoryUsage 12.82 MB +0% -0% 12.79 MB +0% -0% 0.25%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

27f1fd1 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Navigates the list via UP/DOWN arrow keys from action buttons in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' }) with timeout 5000ms
  - waiting for getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
    14 × locator resolved to <button type="button" tabindex="-1" class="components-button is-small" id="view-list-0-164-primary-action-edit-post">Edit</button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:243:5
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
Undo restores the post selection when another synced entity is loaded in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 2,
+   "offset": 2,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
does not select blocks in the canvas preview when editing from the sidebar in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
falls back to the first tab when the default tab is removed in /test/e2e/specs/editor/blocks/tabs.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: 0

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/tabs.spec.js:344:60
should restore an older revision in /test/e2e/specs/editor/various/revisions.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
      "attributes": Object {
-       "content": "Original content - Updated content - Autosaved",
+       "content": "Original content",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/revisions.spec.js:146:5
should select synced pattern in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]') with timeout 5000ms
  - waiting for locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
    13 × locator resolved to <div tabindex="0" role="document" draggable="true" data-title="Pattern" data-type="core/block" data-is-drop-zone="true" aria-label="Block: Pattern" id="block-d9e8969c-5c75-49ec-bc7c-335dc5ca1eb7" data-block="d9e8969c-5c75-49ec-bc7c-335dc5ca1eb7" class="block-editor-block-list__block wp-block is-selected is-reusable block-library-block__reusable-block-container wp-block-block block-editor-block-list__layout">…</div>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:1464:5

27f1fd1 Run

This branch has not been deployed

No deployments
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.

1 participant