Skip to content

Duotone: Remove null from get_all_global_style_block_names return type - #86107

Closed
noruzzamans wants to merge 1 commit into
WordPress:trunkfrom
noruzzamans:fix/phpstan-duotone-return-type
Closed

noruzzamans wants to merge 1 commit into
WordPress:trunkfrom
noruzzamans:fix/phpstan-duotone-return-type

Conversation

@noruzzamans

Copy link
Copy Markdown
Member

What?

See #86088

Removes null from the @return docblock tag of WP_Duotone_Gutenberg::get_all_global_style_block_names(), bringing it in line with its implementation and WordPress Core, and removes the resolved entry from the PHPStan baseline.

Why?

WP_Duotone_Gutenberg::get_all_global_style_block_names() initializes self::$global_styles_block_names as an array and always returns an array of block names keyed on the block name. It never returns null.

PHPStan reports this as return.unusedType (Method WP_Duotone_Gutenberg::get_all_global_style_block_names() never returns null so it can be removed from the return type). In WordPress Core, WP_Duotone::get_all_global_style_block_names() already documents @return string[]. This resolves 1 of the errors initially baselined in #66693.

How?

  • Updated the @return tag on WP_Duotone_Gutenberg::get_all_global_style_block_names() in lib/class-wp-duotone-gutenberg.php from null|array<string, string> to array<string, string>.
  • Removed the corresponding return.unusedType entry from tools/phpstan/baseline.neon.

No PHP source logic or runtime behavior is changed.

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 occurrence and draft the change. I reviewed the diff and take responsibility for it.

@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: noruzzamans <noruzzaman@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.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@noruzzamans

Copy link
Copy Markdown
Member Author

Closed in favor of #86103, which includes this Duotone return type fix alongside the Theme JSON fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant