Skip to content

Themes: Call static process_blocks_custom_css() statically in WP_Theme_JSON - #16093

Closed
westonruter wants to merge 1 commit into
WordPress:trunkfrom
westonruter:fix/theme-json-static-process-blocks-custom-css
Closed

westonruter wants to merge 1 commit into
WordPress:trunkfrom
westonruter:fix/theme-json-static-process-blocks-custom-css

Conversation

@westonruter

@westonruter westonruter commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

✅ Committed in r65770 (2da24ad).


Backport of:

WP_Theme_JSON::process_blocks_custom_css() is declared public static, but three call sites, one in get_custom_css() and two in get_styles_for_block(), invoke it as $this->process_blocks_custom_css(), while two others in get_styles_for_block() already use static::. This changes the three to static:: as well. Behavior is unchanged, since both forms resolve the method with late static binding.

In Gutenberg, the same change lets the dynamicCallOnStaticMethod rule from phpstan-strict-rules be enabled, since these were its only errors there. Making it here too keeps WP_Theme_JSON in sync with WP_Theme_JSON_Gutenberg.

Trac ticket: https://core.trac.wordpress.org/ticket/66739

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5 (medium effort)
Used for: Porting the change from the Gutenberg PR, running the WP_Theme_JSON tests, and drafting this description.


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.

WP_Theme_JSON::process_blocks_custom_css() is declared public static,
but three call sites invoked it as $this->process_blocks_custom_css(),
while two others already use static::. Use static:: for all of them.
Behavior is unchanged, since both forms resolve with late static
binding.

Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com>
Claude-Code-Session-Id: dd6ba841-fda3-4a15-8474-62f4e9285131
@github-actions

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.

@westonruter
westonruter marked this pull request as ready for review November 19, 2026 20:18
@github-actions

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 or WordPress.org 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.

wporg-sync pushed a commit that referenced this pull request Nov 25, 2026
The `WP_Theme_JSON::process_blocks_custom_css()` method is declared static, yet three of its call sites invoked it through `$this` while the others already used `static::`. Behavior is unchanged, since both forms resolve the method with late static binding. In Gutenberg the same change, made in WordPress/gutenberg#87058, cleared the only errors of the `dynamicCallOnStaticMethod` rule from phpstan-strict-rules, so making it here keeps `WP_Theme_JSON` in sync with its Gutenberg counterpart.

Developed in #16093.
Follow-up to r55192, r58421.

Props noruzzaman, westonruter.
See #66739.


git-svn-id: https://develop.svn.wordpress.org/trunk@65770 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 25, 2026
The `WP_Theme_JSON::process_blocks_custom_css()` method is declared static, yet three of its call sites invoked it through `$this` while the others already used `static::`. Behavior is unchanged, since both forms resolve the method with late static binding. In Gutenberg the same change, made in WordPress/gutenberg#87058, cleared the only errors of the `dynamicCallOnStaticMethod` rule from phpstan-strict-rules, so making it here keeps `WP_Theme_JSON` in sync with its Gutenberg counterpart.

Developed in WordPress/wordpress-develop#16093.
Follow-up to r55192, r58421.

Props noruzzaman, westonruter.
See #66739.

Built from https://develop.svn.wordpress.org/trunk@65770


git-svn-id: http://core.svn.wordpress.org/trunk@64799 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