Skip to content

Sync three small PHPStan fixes from Core - #86099

Merged
westonruter merged 3 commits into
WordPress:trunkfrom
huzaifaalmesbah:fix/phpstan-compat-core-sync
Nov 3, 2026
Merged

westonruter merged 3 commits into
WordPress:trunkfrom
huzaifaalmesbah:fix/phpstan-compat-core-sync

Conversation

@huzaifaalmesbah

@huzaifaalmesbah huzaifaalmesbah commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

What?

See #86088

Syncs three small fixes from WordPress Core into Gutenberg's WordPress 7.1 compat files and block supports, and removes the resolved entries from the PHPStan baseline.

Why?

In each case the Core counterpart is already fixed, so the Gutenberg copy was out of sync. PHPStan reports the differences as notIdentical.alwaysTrue, parameter.notFound, and isset.property. This resolves 3 of the 226 errors initially baselined in #66693.

How?

  • lib/compat/wordpress-7.1/class-gutenberg-view-config-data.php: removed the trailing && array() !== $current from the shape check in merge_properties(). ! array_is_list( $current ) is already false for an empty array, so the extra check was always true. This matches WP_View_Config_Data::merge_properties() in Core.
  • lib/compat/wordpress-7.1/class-wp-rest-icon-collections-controller.php: corrected @param WP_REST_Request $_request to $request in get_items_permissions_check(), to match the parameter name and Core's docblock.
  • lib/block-supports/states.php: dropped isset( $block_type->selectors ), since WP_Block_Type::$selectors is always set, keeping only the is_array() check. This matches wp_render_block_states_support() in Core.
  • Removed the 3 corresponding entries from tools/phpstan/baseline.neon.

There is no change in behavior, and no Core backport is needed since all three changes already exist in Core.

Testing Instructions

  1. Run composer phpstan and confirm it passes with no unmatched ignored errors.
  2. Run composer phpstan:baselines and confirm tools/phpstan/baseline.neon has no further changes.

Testing Instructions for Keyboard

Not applicable. There are no UI changes.

Screenshots or screencast

Not applicable.

Use of AI Tools

I used Claude Code to identify the affected occurrences and draft the change. I reviewed the diff and take responsibility for it.

Drop the redundant `array() !== $current` check in `Gutenberg_View_Config_Data::merge_properties()`, since `! array_is_list( $current )` already excludes an empty array, and correct the `@param` name in `WP_REST_Icon_Collections_Controller::get_items_permissions_check()`. Both already match WordPress Core. Remove the 2 resolved entries from the PHPStan baseline.

See WordPress#86088.
@huzaifaalmesbah huzaifaalmesbah added [Type] Code Quality Issues or PRs that relate to code quality Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 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: huzaifaalmesbah <huzaifaalmesbah@git.wordpress.org>
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.

`WP_Block_Type::$selectors` is always set, so only the `is_array()` check is needed. This matches `wp_render_block_states_support()` in WordPress Core. Remove the resolved entry from the PHPStan baseline.

See WordPress#86088.
@huzaifaalmesbah huzaifaalmesbah changed the title Sync two WordPress 7.1 compat fixes from Core Sync three small PHPStan fixes from Core Nov 1, 2026
@huzaifaalmesbah
huzaifaalmesbah marked this pull request as ready for review November 1, 2026 03:38
@westonruter
westonruter merged commit 2361c55 into WordPress:trunk Nov 3, 2026
76 checks passed
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants