Docs: Add descriptive text to @return tags in various function DocBlocks across admin and includes files.#10863
Conversation
…locks across admin and includes files.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
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. |
There was a problem hiding this comment.
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
@returntext to functions inwp-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@returnannotations 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.
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>
|
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 |
| * @since 6.7.0 | ||
| * | ||
| * @return array | ||
| * @return array<string, array<string, array<string, string>>> The raw plugin debug data for active and inactive plugins. |
There was a problem hiding this comment.
The nested @return type looks a bit complex; is this the preferred level of detail for Core PHPDoc?
There was a problem hiding this comment.
This uses PHPStan/Psalm-style generics, which might be more detailed.
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