Opened 7 months ago
Closed 9 days ago
#63249 closed defect (bug) (fixed)
Minor code and inline docs improvements in class-wp-rest-server.php
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | has-patch |
| Focuses: | docs | Cc: |
Description
Inline Documentation Improvement
Some @param tags are missing default value annotations. e.g:
@param string|null— the default value should be specified when applicable.@param false|null— missing mention of the default value.
Conditional Logic Adjustment
Function: get_json_last_error()
The current condition:
if ( JSON_ERROR_NONE === $last_error_code || empty( $last_error_code ) ) {
Proposed change:
if ( empty( $last_error_code ) || JSON_ERROR_NONE === $last_error_code ) {
This change reorders the condition to check for an empty value first, which is a common best practice. It improves readability and slightly optimizes performance by short-circuiting sooner when $last_error_code is empty.
Change History (16)
This ticket was mentioned in PR #8662 on WordPress/wordpress-develop by @dilipbheda.
7 months ago
#1
#2
@
7 months ago
- Milestone changed from Awaiting Review to 6.9
- Owner set to audrasjb
- Status changed from new to reviewing
This ticket was mentioned in Slack in #core by welcher. View the logs.
2 weeks ago
#5
@
2 weeks ago
- Keywords needs-refresh added
This was reviewed in the 6.9 Bug Scrub today. The associated PR has conflicts and needs to be refreshed.
#6
@
2 weeks ago
I’ve reviewed the latest code in class-wp-rest-server.php on trunk.
The get_json_last_error() function correctly checks only for JSON_ERROR_NONE and returns false as expected.
The redundant empty() check has been removed as per changeset [60151].
Inline docs are consistent as well.
Looks good to mark as fixed. Thanks everyone!
#7
@
11 days ago
I left a comment in the PR.
The only chunk that doesn't currently apply has already been resolved, as noted by @khushdoms.
The rest of the changes in the PR seem to still be pending and apply cleanly.
#8
@
11 days ago
Thanks @kirasong for confirming.
I’ve rechecked the latest trunk — everything looks good, and the conflicting part was already resolved in [60151].
This can be refreshed or marked as fixed.
This ticket was mentioned in PR #10447 on WordPress/wordpress-develop by @shailu25.
11 days ago
#9
- Keywords needs-refresh removed
Refreshed PR: 8662
Trac ticket: https://core.trac.wordpress.org/ticket/63249
@shailu25 commented on PR #8662:
11 days ago
#10
I have Created PR 10447 & Rebased with Latest Trunk and also removed mentioned Changes
@mukesh27 commented on PR #8662:
11 days ago
#11
I have Created PR 10447 & Rebased with Latest Trunk and also removed mentioned Changes
I don't think separate PR needed as it's minor revert that can be taken care when commit.
In 60151: