Make WordPress Core

Opened 3 weeks ago

Closed 3 weeks ago

#64262 closed defect (bug) (fixed)

Coding Standards: Fix improper @return tag documentation across core files

Reported by: huzaifaalmesbah's profile huzaifaalmesbah Owned by: westonruter's profile westonruter
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

Fixes @return tag documentation violations in WordPress core to comply with PHP Documentation Standards.

Changes:

  • Replace boolean/Boolean with bool
  • Replace integer/Integer with int
  • Add descriptions to @return tags (type + description required per standards)

Files Modified: 10 files, 29 functions total

  • wp-includes: class-wp-theme-json-resolver.php, block-supports/elements.php, class-json.php, formatting.php, comment.php, functions.php
  • wp-admin/includes: plugin.php, widgets.php, user.php, upgrade.php

Example:

// Before
@return integer|null

// After
@return int|null
// Before
@return string

// After
@return string The base name of the given path.

Change History (7)

#1 @hmbashar
3 weeks ago

  • Focuses docs coding-standards added

This ticket was mentioned in PR #10522 on WordPress/wordpress-develop by @huzaifaalmesbah.


3 weeks ago
#2

  • Keywords has-patch added

## Description
Fixes https://core.trac.wordpress.org/ticket/64262

Updates @return tag documentation to comply with WordPress PHP Documentation Standards.

Changes:

  • Replace boolean/Boolean with bool
  • Replace integer/Integer with int
  • Add descriptions to @return tags (type + description required)

Files: 10 files, 29 functions

  • wp-includes: class-wp-theme-json-resolver.php, block-supports/elements.php, class-json.php, formatting.php, comment.php, functions.php
  • wp-admin/includes: plugin.php, widgets.php, user.php, upgrade.php

Example:

// Before
@return integer|null

// After
@return int|null
// Before
@return string

// After  
@return string The base name of the given path.

Testing:

  • [x] Documentation-only changes
  • [x] No functional code modifications
  • [x] Complies with WordPress Coding Standards

#3 @noruzzaman
3 weeks ago

Thanks for the patch, @huzaifaalmesbah! I’ve reviewed the changes and they look good to me. The @return tags are now using bool/int and include clear descriptions in accordance with the WordPress PHP Documentation Standards. I’ve also confirmed this is documentation-only with no functional code changes. Nice improvement to consistency across the affected core files.

#4 @westonruter
3 weeks ago

  • Milestone changed from Awaiting Review to 7.0
  • Owner set to westonruter
  • Status changed from new to reviewing

@huzaifaalmesbah commented on PR #10522:


3 weeks ago
#5

Thanks @westonruter and @sabernhardt for your detailed reviews and helpful suggestions. I've applied all the recommended changes, and I’ve ignored updates to src/wp-includes/class-json.php as advised since it's a third-party library and deprecated.

@huzaifaalmesbah commented on PR #10522:


3 weeks ago
#6

Thanks for the updates @westonruter The docs feel a lot clearer and more helpful now.

#7 @westonruter
3 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 61270:

Docs: Add missing descriptions and fix types for some @return tags.

Props huzaifaalmesbah, sabernhardt, westonruter.
See #64224.
Fixes #64262.

Note: See TracTickets for help on using tickets.