Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#63892 closed defect (bug) (fixed)

Fix grammar and PHPDoc inconsistencies in functions.php

Reported by: prab18hat's profile prab18hat Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: docs Cc:

Description

Summary of Changes:

Standardized PHPDoc for is_new_day():

Updated the @return type from int to bool for clarity and modern PHPDoc standards.

Grammar and Docblock Improvements in functions.php:

xmlrpc_getpostcategory(): Clarified the return type and simplified awkward phrasing for readability.

get_weekstartend(): Improved the @param description for $start_of_week to clearly state “Default is an empty string.”

build_query(): Corrected grammar by adding the missing article and removing an unnecessary comma.

Old: Builds URL query based on an associative and, or indexed array.

New: Builds a URL query based on an associative or indexed array.

get_status_header_desc(): Updated return description to: “Status description if found, or an empty string otherwise.” for better clarity.

Change History (7)

This ticket was mentioned in PR #9653 on WordPress/wordpress-develop by prab18hat.


6 months ago
#1

  • Keywords has-patch added
  • Updated @return type for is_new_day() from int to bool
  • Clarified return type in xmlrpc_getpostcategory()
  • Improved @param description for get_weekstartend()
  • Corrected grammar in build_query() docblock
  • Improved return description in get_status_header_desc()

Summary of Changes:

Standardized PHPDoc for is_new_day():

Updated the @return type from int to bool for clarity and modern PHPDoc standards.

Grammar and Docblock Improvements in functions.php:

xmlrpc_getpostcategory(): Clarified the return type and simplified awkward phrasing for readability.

get_weekstartend(): Improved the @param description for $start_of_week to clearly state “Default is an empty string.”

build_query(): Corrected grammar by adding the missing article and removing an unnecessary comma.

Old: Builds URL query based on an associative and, or indexed array.

New: Builds a URL query based on an associative or indexed array.

get_status_header_desc(): Updated return description to: “Status description if found, or an empty string otherwise.” for better clarity.

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

@dhruvang21 commented on PR #9653:


6 months ago
#2

@prab18hat you also need to update the test cases code to pass the phpunit tests

public function data_is_new_date() {
		return array(
			array( '21.05.19', '21.05.19', false ),
			array( '21.05.19', '20.05.19', true ),
			array( '21.05.19', false, true ),
		);
	}

@prab18hat commented on PR #9653:


6 months ago
#3

Thanks for the feedback! I’ve updated the test cases for is_new_day() so that the data provider now returns booleans (true/false). The PHPUnit assertions now match the updated return type.

@swissspidy commented on PR #9653:


6 months ago
#4

🚨 We cannot just change the return type of is_new_day(). That would be a breaking change. We need to ensure backward compatibility. Please revert those changes.

#5 @SergeyBiryukov
6 months ago

  • Focuses docs added
  • Keywords needs-docs removed
  • Milestone changed from Awaiting Review to 6.9
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Just noting that:

  • Default empty string is correct as per the documentation standards, and should not be changed, as there are many more instances of that wording in core.
  • As noted above, changing the return type of is_new_day() is unrelated to the documentation improvements, and should not be done in this ticket.

#6 @SergeyBiryukov
6 months ago

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

In 60687:

Docs: Improve grammar in some DocBlocks for more clarity and consistency.

Follow-up to [8215], [8598].

Props prab18hat, dhruvang21, swissspidy, SergeyBiryukov.
Fixes #63892.

@prab18hat commented on PR #9653:


6 months ago
#7

  • Updated @return type for is_new_day() from int to bool
  • Clarified return type in xmlrpc_getpostcategory()
  • Improved @param description for get_weekstartend()
  • Corrected grammar in build_query() docblock
  • Improved return description in get_status_header_desc()

Summary of Changes:

Standardized PHPDoc for is_new_day():

Updated the @return type from int to bool for clarity and modern PHPDoc standards.

Grammar and Docblock Improvements in functions.php:

xmlrpc_getpostcategory(): Clarified the return type and simplified awkward phrasing for readability.

get_weekstartend(): Improved the @param description for $start_of_week to clearly state “Default is an empty string.”

build_query(): Corrected grammar by adding the missing article and removing an unnecessary comma.

Old: Builds URL query based on an associative and, or indexed array.

New: Builds a URL query based on an associative or indexed array.

get_status_header_desc(): Updated return description to: “Status description if found, or an empty string otherwise.” for better clarity.

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

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Hi, I noticed this PR was closed after the Trac ticket was fixed. However, some of the docblock and grammar improvements here are not yet in trunk. If possible, could a maintainer please reopen this PR so I can update it, or should I open a new PR instead? Thank you!

Note: See TracTickets for help on using tickets.