Repository navigation
Theme JSON Resolver: Document cached static properties as nullable - #86111
westonruter merged 2 commits into
Conversation
🤖 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 |
|
Looks good. Core's |
westonruter
left a comment
There was a problem hiding this comment.
I've opened WordPress/wordpress-develop#15385 to apply the same fixes to core.
The cached static properties of `WP_Theme_JSON_Resolver` all default to `null` and are reset to `null` in `clean_cached_data()`, and the getters check them against `null` to decide whether to rebuild the cache, but their `@var` tags omitted `null`. Adding it removes the six resulting `assign.propertyType` entries from the PHPStan baseline. There is no runtime change. This mirrors the same fix to `WP_Theme_JSON_Resolver_Gutenberg` in the Gutenberg plugin, developed in WordPress/gutenberg#86111. Developed in #15385. Follow-up to r50959, r52049, r54493, r63022. Props noruzzaman, huzaifaalmesbah. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65218 602fd350-edb4-49c9-b593-d223f7449a82
The cached static properties of `WP_Theme_JSON_Resolver` all default to `null` and are reset to `null` in `clean_cached_data()`, and the getters check them against `null` to decide whether to rebuild the cache, but their `@var` tags omitted `null`. Adding it removes the six resulting `assign.propertyType` entries from the PHPStan baseline. There is no runtime change. This mirrors the same fix to `WP_Theme_JSON_Resolver_Gutenberg` in the Gutenberg plugin, developed in WordPress/gutenberg#86111. Developed in WordPress/wordpress-develop#15385. Follow-up to r50959, r52049, r54493, r63022. Props noruzzaman, huzaifaalmesbah. See #65817. Built from https://develop.svn.wordpress.org/trunk@65218 git-svn-id: http://core.svn.wordpress.org/trunk@64367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
See #86088
Documents cached static properties on WP_Theme_JSON_Resolver_Gutenberg as nullable in their @var docblocks, and removes the resolved entries from the PHPStan baseline.
Why?
The static properties $core, $blocks, $theme, $user, $user_custom_post_type_id, and $i18n_schema are all initialized to null and reset to null in clean_cached_data(). Because their @var docblocks documented them without |null, PHPStan reported assign.propertyType errors when they are reset. This resolves 6 of the 226 errors initially baselined in #66693.
How?
There is no runtime logic change, only docblock corrections.
Testing Instructions
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.