Skip to content

Customize: Correct the types of the header image control properties. - #16345

Open
mllacer27-prog wants to merge 3 commits into
WordPress:trunkfrom
mllacer27-prog:fix/66739-header-image-control-types
Open

mllacer27-prog wants to merge 3 commits into
WordPress:trunkfrom
mllacer27-prog:fix/66739-header-image-control-types

Conversation

@mllacer27-prog

Copy link
Copy Markdown

$uploaded_headers and $default_headers in WP_Customize_Header_Image_Control were documented as string, but prepare_control() fills them with the arrays returned by Custom_Image_Header::get_uploaded_header_images() and Custom_Image_Header::get_default_header_images(), which are both documented as returning array.

This updates the two @var tags to array and removes the two matching entries from the assign.propertyType baseline.

Why the code was like this: before 3.9 these properties were documented as array ("The processed default headers"). The docblocks were dropped when the header UI was rewritten in 27497, and were added back later as @var string.

Behavior: unchanged. Only docblocks and the baseline are touched.

Testing: relying on the PHPStan check in GitHub Actions for this PR.

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

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Claude Opus 5.5
Used for: Explaining the PHPStan error, finding the original changeset and helping draft this description. I made and checked the change myself.


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.

@github-actions

github-actions Bot commented Nov 30, 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 m27lyon, lancewillett.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the header image property type documentation changes and associated PHPStan baseline cleanup.

No open issues 🎉

What changed in this PR

Corrects the documented types of the Customizer header image control properties to match the arrays assigned by prepare_control(). Runtime behavior is unchanged.

Changes:

  • Changes the @var tags for $uploaded_headers and $default_headers from string to array.
  • Removes the two corresponding PHPStan baseline suppressions.
File Description
tests/​phpstan/​baselines/​assign.propertyType.neon Removes suppressions for the corrected property types.
src/​wp-includes/​customize/​class-wp-customize-header-image-control.php Documents both header image properties as arrays.

Review effort: Balanced

@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.

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The two baseline removals check out. Without them PHPStan reports exactly two assignment errors on the parent. There’s one small correction to the documented types.

AI review · gpt-6.2-astra

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both properties now document the null value that survives the early return from prepare_control(). The array assignments and the two removed PHPStan suppressions match the updated types. Thanks for the correction.

AI review · gpt-6.2-astra

@lancewillett lancewillett moved this from In progress to In review in WordPress Project Build Tooling Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants