Opened 4 weeks ago
Last modified 43 hours ago
#65860 new task (blessed)
Docblock improvements for 7.2
| Reported by: | desrosj | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | docs |
Description
Previously:
- #64896 (7.1)
- #64224 (7.0)
- #63166 (6.9)
- #62281 (6.8)
- #61608 (6.7)
- #60699 (6.6)
- #59651 (6.5)
- #58833 (6.4)
- #57840 (6.3)
- #56792 (6.2)
- #55646 (6.1)
- #54729 (6.0)
- #53399 (5.9)
- #52628 (5.8)
- #51800 (5.7)
- #50768 (5.6)
- #49572 (5.5)
- #48303 (5.4)
- #47110 (5.3)
- #46543 (5.2)
- #42505 (5.1)
- #41017 (4.9)
- #39130 (4.8)
- #37770 (4.7)
- #32246 (4.6)
Change History (25)
This ticket was mentioned in PR #12251 on WordPress/wordpress-develop by @shailu25.
4 weeks ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #12823 on WordPress/wordpress-develop by @bejignesh.
4 weeks ago
#2
Three core-owned methods are missing a @param tag.
WP_HTTP_IXR_Client::query()
The docblock already records that the ...$args parameter was formalized in 5.5.0 by adding it to the signature, but the parameter itself was never documented. WP_Dependency::__construct() carries the same @since wording and does document it as @param mixed ...$args Dependency information., so this brings the two back in line.
The description matches what the method does with the value: array_shift( $args ) takes the method name, and the remainder are the arguments passed to it.
WP_REST_Font_Collections_Controller::get_items_permissions_check()
Has @since and @return but no @param for $request.
WP_REST_Font_Families_Controller::get_endpoint_args_for_item_schema()
Has @since and @return but no @param for $method.
### Testing
--group xmlrpcpasses, 318 tests.- The font controller REST tests pass, 143 tests.
phpcsclean on all three files.php -lclean on all three files.
Documentation only, no behaviour change.
Originally opened against #64896, which was closed when 7.1 reached RC3
without this being committed. Moved to the 7.2 docblock ticket.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Drafting the tags and this description. I confirmed each gap against the current file, checked the variadic wording against how core documents the same parameter on WP_Dependency::__construct(), verified the ...$args description against the method body, confirmed no existing ticket or pull request already covers these three, ran the xmlrpc and font REST tests plus phpcs, and I take responsibility for the result.
This ticket was mentioned in PR #12792 on WordPress/wordpress-develop by @bejignesh.
4 weeks ago
#3
Five functions in Twenty Nineteen and Twenty Twelve take arguments but have no @param tag at all, just a one line description.
Twenty Nineteen (inc/template-tags.php)
twentynineteen_get_user_avatar_markup( $id_or_email = null )twentynineteen_discussion_avatars_list( $comment_authors )twentynineteen_comment_form( $order )
Twenty Twelve (functions.php)
twentytwelve_page_menu_args( $args )twentytwelve_content_nav( $html_id )
The Twenty Twelve file documents parameters throughout, so those two stand out as gaps rather than a house style.
## Notes on the types
They come from the call sites, not from guesswork.
twentynineteen_comment_form() is documented as bool|string, because comments.php calls it three times, with 'desc', 'asc', and true. The body reads if ( true === $order || strtolower( $order ) === strtolower( get_option( 'comment_order', 'asc' ) ) ), so true forces display while a string only displays when it matches the option. The description says that rather than just listing the types.
twentynineteen_discussion_avatars_list() receives $discussion->authors, built in twentynineteen_get_discussion_data() as ( (int) $comment->user_id > 0 ) ? (int) $comment->user_id : $comment->comment_author_email, so entries are a user ID or an email address where there is no account.
twentynineteen_get_user_avatar_markup() passes its argument straight to get_avatar(), so it takes that function's wording for the accepted types. It also returns markup, so it gains a @return.
twentytwelve_page_menu_args() is a wp_page_menu_args filter callback and returns the array, so it gains a @return as well.
## What is deliberately not changed
No @since tags are added. The Twenty Nineteen file does not use them on functions, and adding them would mean guessing at versions. The two Twenty Twelve functions already have theirs.
No functional change. phpcs passes on both files.
Originally opened against #64896, which was closed when 7.1 reached RC3
without this being committed. Moved to the 7.2 docblock ticket.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Scanning src/ for functions whose docblocks omit their parameters, which is how these were found, and drafting this description. I read each call site to confirm the types, ran phpcs, and I take responsibility for the change.
This ticket was mentioned in PR #13203 on WordPress/wordpress-develop by @jonsurrell.
3 weeks ago
#6
Docs-only follow-up to r62595 (#12319), which rolled back a change to the parse_next_attribute() return docs so it wouldn't hold up the fix. See the review discussion: https://github.com/WordPress/wordpress-develop/pull/12319#discussion_r3494789615
Two things were in tension there:
- The return value should be framed positively — "whether an attribute was found" — not as a continuation flag. A
truemeans one was found, not that more follow; afalsemeans none was found, whether because the document ended or some other stop condition was reached. - The existing doc was confusing in practice: it returns
trueon end tags even though end tags don't have attributes, and "before the end of the document" is not the only reason it returnsfalse(reaching>is the common one).
This keeps the positive framing and resolves the confusion by making the implicit parts explicit:
- States up front that attribute syntax is parsed on both start and end tags, and that on end tags the attribute is consumed and discarded rather than recorded, but still reported as found.
- Explains why callers loop on it (finding one means another may follow) while being clear that
truedoesn't promise more. - Names the concrete
falseconditions: end of tag (>or/>) or end of document. - Lists the side effects (cursor advance, attribute recording, self-closing flag,
STATE_INCOMPLETE_INPUT). - Adds an inline comment at the
is_closing_tagearly return, which is the line that prompted the original question.
No behavior change. php -l and phpcs pass; tests/phpunit/tests/html-api/wpHtmlTagProcessor.php passes (560 tests).
Follow-up to r62595 (see #65372).
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5
Used for: Drafting the docblock and inline comment text from the linked review discussion; reviewed and edited by me.
@bejignesh commented on PR #12792:
3 weeks ago
#8
@mukeshpanchal27 Any chance you can sign this off?
@bejignesh commented on PR #12823:
3 weeks ago
#9
@mukeshpanchal27 Any chance you can sign this off?
This ticket was mentioned in PR #13238 on WordPress/wordpress-develop by @johnbillion.
3 weeks ago
#10
This property was introduced in 6.5 but wasn't added to the WP_Block_Type docs.
Refs:
- https://github.com/WordPress/wordpress-develop/blob/95639420293b22905266a0dd59cf5427756db9d7/src/wp-includes/class-wp-block-type.php#L229-L235
- https://github.com/WordPress/wordpress-develop/blob/95639420293b22905266a0dd59cf5427756db9d7/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php#L248
Trac ticket: Core-65860
This ticket was mentioned in PR #13267 on WordPress/wordpress-develop by @jonsurrell.
3 weeks ago
#12
Two HTML API docblocks carry an interactive example that loads WordPress by hand:
WP_HTML_Processor::class_list()WP_HTML_Tag_Processor::class_list()
Interactive examples in the Code Reference run in WordPress Playground. Playground now prepends the bootstrap before it runs a snippet (WordPress/wordpress-playground#4262), and the Code Reference theme loads WordPress before the snippet (WordPress/wporg-developer#579). The leading <?php and the require '/wordpress/wp-load.php'; do nothing now, and readers still see them in the rendered example. This removes both.
The examples also print with echo and state the output in a trailing comment instead of a separate expected-output block.
See:
- https://github.com/WordPress/wordpress-playground/pull/4262
- https://github.com/WordPress/wporg-developer/pull/579
## Use of AI Tools
- AI assistance: Yes
- Tool(s): Claude Code
- Model(s): Claude Opus 5
- Used for: This pull request description. The code change is mine.
@jonsurrell commented on PR #13267:
8 days ago
#15
Merged in r63463.
@wildworks commented on PR #12792:
7 days ago
#17
@jonsurrell commented on PR #13203:
5 days ago
#20
Merged in r63515.
This ticket was mentioned in PR #13476 on WordPress/wordpress-develop by @Njones35.
2 days ago
#24
### Why this change?
The PHP inline documentation standards state, in the @param, @return and @global sections:
For boolean and integer types, use
boolandint, respectively.
Six docblocks in core code still used the long forms. This brings them in line.
| File | Tag |
|---|---|
wp-includes/class-wp-theme-json.php | @param boolean $use_root_padding
|
wp-includes/global-styles-and-settings.php | @param boolean $fallback
|
wp-includes/html-api/class-wp-html-tag-processor.php | @return string\||boolean\||null
|
wp-includes/media.php | @param boolean $enabled
|
wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | @param integer $id
|
wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | @param integer $id
|
### Notes on scope
Parameter columns are realigned where needed. In class-wp-theme-json.php, shortening boolean makes string the longest type in that block, so the whole @param column shifts left by one to stay aligned. That is why the file shows six changed lines rather than one.
Bundled third-party libraries are left untouched. Services_JSON (wp-includes/class-json.php) alone has four more instances, but core does not take style changes to vendored code.
The prose in class-wp-html-tag-processor.php is left alone. The description above the tag reads "If an update is enqueued and is boolean, the return will be true". That is English describing a value, not a type declaration, so the standard does not apply to it.
After this change, src/ has no remaining boolean or integer types in core PHP docblocks.
### Testing
php -lclean on all six files.phpcs --standard=phpcs.xml.distreports 0 errors on all six files. There is one pre-existing warning atmedia.php:5723(WordPress.DB.PreparedSQL.NotPrepared), unrelated to this change and ~3,600 lines away from it; I confirmed it is present on trunk without this patch.
Documentation only, no behaviour change, so no test changes are needed.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Scanning src/ for the long-form types, which is how these six were found, applying the substitutions and column realignment, and drafting this description. I checked each site against the current file, confirmed the third-party exclusions, verified the pre-existing phpcs warning is present on trunk without this patch, confirmed no open pull request already touches these docblocks, ran php -l and phpcs, and I take responsibility for the result.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: #65860
### Why this change?
@seetag before@paramtag in Below files:src/wp-includes/author-template.phpsrc/wp-includes/customize/class-wp-customize-nav-menu-setting.php@globaltag after@seetag in Below files:src/wp-includes/post.phpsrc/wp-includes/taxonomy.php@deprecatedtag after@sincetag in Below file:src/wp-includes/interactivity-api/class-wp-interactivity-api.php## Use of AI Tools