Skip to content

Docs: Use the bool and int short forms in docblocks. - #13476

Closed
njonesfermoy2011-rgb wants to merge 1 commit into
WordPress:trunkfrom
njonesfermoy2011-rgb:docs/short-scalar-types
Closed

Docs: Use the bool and int short forms in docblocks.#13476
njonesfermoy2011-rgb wants to merge 1 commit into
WordPress:trunkfrom
njonesfermoy2011-rgb:docs/short-scalar-types

Conversation

@njonesfermoy2011-rgb

@njonesfermoy2011-rgb njonesfermoy2011-rgb commented Sep 10, 2026

Copy link
Copy Markdown

✅ Committed in r63596 (2a616e3).


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

Why this change?

The PHP inline documentation standards state, in the @param, @return and @global sections:

For boolean and integer types, use bool and int, 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 -l clean on all six files.
  • phpcs --standard=phpcs.xml.dist reports 0 errors on all six files. There is one pre-existing warning at media.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.

The PHP inline documentation standards state, in the `@param`, `@return`
and `@global` sections: "For boolean and integer types, use `bool` and
`int`, respectively."

Six docblocks in core code still used the long forms. Bundled third-party
libraries are left untouched.

Parameter columns are realigned where the shorter type changes the width
of the type column.

Documentation only, no behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

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

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

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

wporg-sync pushed a commit that referenced this pull request Sep 10, 2026
The PHP inline documentation standards call for `bool` and `int` in `@param`, `@return` and `@global` tags, but six docblocks in `src/wp-includes` still carried the long `boolean` and `integer` spellings. 

Developed in #13476.
Follow-up to r63495.

Props njones35.
See #65860.


git-svn-id: https://develop.svn.wordpress.org/trunk@63596 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Sep 10, 2026
The PHP inline documentation standards call for `bool` and `int` in `@param`, `@return` and `@global` tags, but six docblocks in `src/wp-includes` still carried the long `boolean` and `integer` spellings. 

Developed in WordPress/wordpress-develop#13476.
Follow-up to r63495.

Props njones35.
See #65860.

Built from https://develop.svn.wordpress.org/trunk@63596


git-svn-id: http://core.svn.wordpress.org/trunk@62772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

2 participants