Skip to content

Docs: Add descriptive text to @return tags in various function DocBlocks across admin and includes files.#10863

Open
huzaifaalmesbah wants to merge 4 commits intoWordPress:trunkfrom
huzaifaalmesbah:fix/missing-return-descriptions
Open

Docs: Add descriptive text to @return tags in various function DocBlocks across admin and includes files.#10863
huzaifaalmesbah wants to merge 4 commits intoWordPress:trunkfrom
huzaifaalmesbah:fix/missing-return-descriptions

Conversation

@huzaifaalmesbah
Copy link
Member

This PR adds missing descriptions to @return tags in various files within src/wp-admin/includes and src/wp-includes to ensure compliance with WordPress Coding Standards.

Trac Ticket: https://core.trac.wordpress.org/ticket/64224

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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

Props huzaifaalmesbah, westonruter, mukesh27.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • 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.

@mukeshpanchal27
Copy link
Member

This all not blocker but nice to have. Thanks @huzaifaalmesbah for the PR!

@westonruter for you if you want to commit or have any suggestions.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates DocBlocks across several admin and includes files to add descriptive text to @return tags, aiming for better clarity and WordPress Coding Standards compliance.

Changes:

  • Added descriptive @return text to functions in wp-includes (e.g., wp_is_mobile() and the IXR HTTP client).
  • Documented return values of various core update, media, list-table, and IIS rewrite helper functions in wp-admin/includes.
  • Expanded WP_Debug_Data’s internal methods with descriptive @return annotations for each debug section.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/wp-includes/vars.php Documents what the bool return from wp_is_mobile() represents.
src/wp-includes/class-wp-http-ixr-client.php Clarifies the success/failure semantics of WP_HTTP_IXR_Client::query().
src/wp-admin/includes/update.php Adds descriptive @return text for core update–related helpers and update nags.
src/wp-admin/includes/misc.php Documents boolean return semantics for IIS7 rewrite rule helper functions.
src/wp-admin/includes/media.php Describes return values for legacy media upload handlers and media field helpers, and clarifies get_compat_media_markup()’s array structure.
src/wp-admin/includes/class-wp-theme-install-list-table.php Clarifies ajax_user_can() and get_views() return values for the theme install list table.
src/wp-admin/includes/class-wp-screen.php Adds a description to the show_screen_options() @return tag, but the new text is inaccurate relative to the method’s behavior.
src/wp-admin/includes/class-wp-media-list-table.php Documents return values for capability checks, views, bulk actions, current action, item presence, sorting, and row actions in the media list table.
src/wp-admin/includes/class-wp-list-table.php Adds descriptive return docs for core list-table helpers like has_items(), get_views(), pagination and column APIs.
src/wp-admin/includes/class-wp-debug-data.php Adds detailed @return descriptions to private section-builder methods, but several descriptions are mismatched with the sections they actually build (e.g., server vs. media vs. themes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

huzaifaalmesbah and others added 2 commits February 5, 2026 00:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updates function docblocks to use more specific array types (e.g. array<string, string>) instead of generic array or mixed types, while avoiding PHPStan array shapes.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@westonruter
Copy link
Member

In keeping also with Core-64238, in 7a409a2 I've had Gemini help me flesh out the return types to be more specific than just simply array.

* @since 6.7.0
*
* @return array
* @return array<string, array<string, array<string, string>>> The raw plugin debug data for active and inactive plugins.

Choose a reason for hiding this comment

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

The nested @return type looks a bit complex; is this the preferred level of detail for Core PHPDoc?

Copy link
Member Author

Choose a reason for hiding this comment

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

This uses PHPStan/Psalm-style generics, which might be more detailed.

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.

4 participants