Docs: Use the bool and int short forms in docblocks. - #13476
Docs: Use the bool and int short forms in docblocks.#13476njonesfermoy2011-rgb wants to merge 1 commit into
bool and int short forms in docblocks.#13476Conversation
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>
|
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. |
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
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
✅ 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,@returnand@globalsections:Six docblocks in core code still used the long forms. This brings them in line.
wp-includes/class-wp-theme-json.php@param boolean $use_root_paddingwp-includes/global-styles-and-settings.php@param boolean $fallbackwp-includes/html-api/class-wp-html-tag-processor.php@return string|boolean|nullwp-includes/media.php@param boolean $enabledwp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php@param integer $idwp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php@param integer $idNotes on scope
Parameter columns are realigned where needed. In
class-wp-theme-json.php, shorteningbooleanmakesstringthe longest type in that block, so the whole@paramcolumn 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.phpis left alone. The description above the tag reads "If an update is enqueued and is boolean, the return will betrue". That is English describing a value, not a type declaration, so the standard does not apply to it.After this change,
src/has no remainingbooleanorintegertypes 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, ranphp -landphpcs, and I take responsibility for the result.