Skip to content

phan: Add Gutenberg global styles and font stub definitions - #52656

Merged
mreishus merged 3 commits into
trunkfrom
reish20260922/stubs
Sep 22, 2026
Merged

mreishus merged 3 commits into
trunkfrom
reish20260922/stubs

Conversation

@mreishus

Copy link
Copy Markdown
Contributor

Proposed changes

Extend the Gutenberg stub generator definitions to extract gutenberg_get_global_settings(), gutenberg_get_global_styles(), gutenberg_print_font_faces(), and WP_Theme_JSON_Resolver_Gutenberg::clean_cached_data().

This PR changes only tools/stubs/gutenberg-stub-defs.php. After it lands, run the Update Phan stubs workflow on trunk (or wait for the scheduled run) and merge the resulting bot-owned generated-stubs PR. That provides the declarations needed by the Google Fonts follow-up without putting generated stub changes in a human-authored PR.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Run the stub generator with these definitions against the published Gutenberg plugin and direct its output to a temporary file. Confirm the output declares all three functions and the public static clean_cached_data() method.

Validated locally against Gutenberg 24.0.0 using Jetpack's stub generator:

No generated files or runtime code are changed, so no product changelog is needed.

@mreishus
mreishus requested a review from a team as a code owner September 22, 2026 19:54
@mreishus mreishus added [Status] Needs Review This PR is ready for review. Task labels Sep 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@anomiex anomiex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable.

Comment thread tools/stubs/gutenberg-stub-defs.php Outdated

@anomiex anomiex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works. One comment inline, but not a blocker.

Comment thread tools/stubs/gutenberg-stub-defs.php Outdated
'lib/client-assets.php' => array(
'lib/class-wp-theme-json-resolver-gutenberg.php' => array(
'class' => array(
'WP_Theme_JSON_Resolver_Gutenberg' => array( 'method' => array( 'clean_cached_data' ) ),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I note this class's documentation says

 * This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes).
 * This is a low-level API that may need to do breaking changes. Please,
 * use gutenberg_get_global_settings, gutenberg_get_global_styles, and gutenberg_get_global_stylesheet instead.
 *
 * @since 5.8.0
 * @access private

But it looks like #52653 only uses it in tests, so meh. For just the one function in some tests, I might be inclined to do a // @phan-suppress-next-line instead of actually stubbing the private class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a bad idea, I'll get rid of it

@mreishus
mreishus merged commit ca562a7 into trunk Sep 22, 2026
72 checks passed
@mreishus
mreishus deleted the reish20260922/stubs branch September 22, 2026 20:35
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Sep 22, 2026
@mreishus mreishus mentioned this pull request Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants