Skip to content

Code Quality: Document theme JSON resolver cached properties as nullable - #15385

Closed
westonruter wants to merge 1 commit into
WordPress:trunkfrom
westonruter:phpstan/theme-json-resolver-nullable-properties
Closed

westonruter wants to merge 1 commit into
WordPress:trunkfrom
westonruter:phpstan/theme-json-resolver-nullable-properties

Conversation

@westonruter

@westonruter westonruter commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

✅ Committed in r65218 (77b1804).


The static caches $core, $blocks, $theme, $user, $user_custom_post_type_id, and $i18n_schema on WP_Theme_JSON_Resolver all default to null and are reset to null in clean_cached_data(), but their @var tags omitted null. This adds |null to each tag and removes the six resulting assign.propertyType entries from tests/phpstan/baselines/assign.propertyType.neon (regenerated via composer phpstan:baselines). There is no runtime change.

Gutenberg companion PR: WordPress/gutenberg#86111

Trac ticket: Core-65817

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5 · high effort
Used for: Reviewing the Gutenberg companion PR, porting the same docblock fix to core, regenerating the PHPStan baseline, and drafting this description. The change was reviewed by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

The static caches `$core`, `$blocks`, `$theme`, `$user`,
`$user_custom_post_type_id`, and `$i18n_schema` on `WP_Theme_JSON_Resolver`
all default to `null` and are reset to `null` in `clean_cached_data()`, but
their `@var` tags left out `null`. Add it, and drop the six resulting
`assign.propertyType` entries from the PHPStan baseline.

This mirrors the same fix to `WP_Theme_JSON_Resolver_Gutenberg` in Gutenberg.

Co-Authored-By: Claude Opus 5.5 (high effort) <noreply@anthropic.com>
Claude-Code-Session-Id: e6cf5d9d-7b29-4126-899f-5239ba40d63b
@westonruter
westonruter marked this pull request as ready for review November 3, 2026 03:37
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter.

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.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

wporg-sync pushed a commit that referenced this pull request Nov 3, 2026
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
@westonruter westonruter closed this Nov 3, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 3, 2026
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
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