Repository navigation
Fix invalid PHPDoc tags reported by PHPStan - #86092
Merged
westonruter merged 2 commits intoNov 1, 2026
Merged
Conversation
Remove the `@throws WP_Error` tags from the Home Link, Navigation, Navigation Link, and Navigation Submenu block registration functions: `WP_Error` is not an exception, and `register_block_type_from_metadata()` does not throw. Fix the unparsable `@param string?` and `@return void.` tags in `WP_Style_Engine` to match WordPress Core. Remove the 6 resolved entries from the PHPStan baseline. See WordPress#86088.
🤖 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 |
huzaifaalmesbah
marked this pull request as ready for review
November 1, 2026 01:52
huzaifaalmesbah
requested review from
fabiankaegy and
manzoorwanijk
as code owners
November 1, 2026 01:52
westonruter
reviewed
Nov 1, 2026
| * Util: Checks whether an incoming block style value is valid. | ||
| * | ||
| * @param string? $style_value A single css preset value. | ||
| * @param string $style_value A single CSS preset value. |
Member
There was a problem hiding this comment.
This now matches the corresponding code in core: https://github.com/WordPress/wordpress-develop/blob/15e95f3530db532da0791c78273325a8a5faca52/src/wp-includes/style-engine/class-wp-style-engine.php#L446-L456
westonruter
approved these changes
Nov 1, 2026
…ix/phpstan-phpdoc-errors
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 #86088
Fixes invalid PHPDoc tags reported by PHPStan in four block registration functions and in
WP_Style_Engine, and removes the resolved entries from the PHPStan baseline.Why?
PHPStan reports these docblocks as invalid, so the documented types are either wrong or ignored entirely. Together, these changes clear 6 of the 226 errors initially baselined in #66693 (all
throws.notThrowableandphpDoc.parseErrorerrors).How?
@throws WP_Errorfromregister_block_core_home_link(),register_block_core_navigation(),register_block_core_navigation_link(), andregister_block_core_navigation_submenu().WP_Erroris not aThrowable, andregister_block_type_from_metadata()returnsfalseon failure rather than throwing. No other block registration function documents a@throwstag.WP_Style_Engine, changed@param string? $style_valueto@param string $style_valueinis_valid_style_value(), and removed the@return void.tag fromstore_css_rule(). Both now match the docblocks in WordPress Core's copy of the class.tools/phpstan/baseline.neon.Docblock changes only; there is no change in behavior.
Testing Instructions
composer phpstanand confirm it passes with no unmatched ignored errors.composer phpstan:baselinesand confirmtools/phpstan/baseline.neonhas 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.