Opened 5 months ago
Closed 3 days ago
#64897 closed task (blessed) (fixed)
Coding Standards fixes for 7.1
| Reported by: | desrosj | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Change History (50)
This ticket was mentioned in PR #11952 on WordPress/wordpress-develop by @khokansardar.
3 months ago
#1
- Keywords has-patch added
@mukesh27 commented on PR #11952:
2 months ago
#2
Mark duplicate of #10780
This ticket was mentioned in PR #12015 on WordPress/wordpress-develop by @mukesh27.
2 months ago
#3
Trac ticket: https://core.trac.wordpress.org/ticket/64897
## Use of AI Tools
N/A
This ticket was mentioned in PR #12024 on WordPress/wordpress-develop by @mukesh27.
2 months ago
#4
Trac ticket: https://core.trac.wordpress.org/ticket/64897
Follow-up to https://github.com/WordPress/wordpress-develop/pull/12015#pullrequestreview-4395315015
## Use of AI Tools
N/A
@mukesh27 commented on PR #12015:
2 months ago
#5
I noticed that the
WP_REST_Icons_Controllerclass is also missing the@sincetag. Should we address that in a separate PR?
Yes. See #12024
@wildworks commented on PR #12024:
2 months ago
#8
This PR was committed by r62435.
@wildworks commented on PR #12015:
2 months ago
#9
This PR was committed by r62434.
This ticket was mentioned in PR #10780 on WordPress/wordpress-develop by @huzaifaalmesbah.
2 months ago
#10
This PR updates variable names in wp-admin includes to strictly adhere to WordPress Coding Standards (lowercase with underscores, no unnecessary abbreviations). These changes focus on local variables to avoid backward compatibility issues.
Trac ticket:
https://core.trac.wordpress.org/ticket/64897
https://core.trac.wordpress.org/ticket/64226
### Changes
- src/wp-admin/includes/post.php: Renamed
$id3datato$id3_datain edit_post(). - src/wp-admin/includes/media.php: Renamed
$extto$extensionand$ext_typeto$extension_typein media_handle_upload() and media_send_to_editor(). - src/wp-admin/includes/image-edit.php: Renamed
$extto$extensionin wp_image_editor().
### Testing Instructions
- Media Upload: Upload image, audio, and video files. Ensure uploads complete successfully and correct icons/metadata are displayed.
- Image Editing: Go to Media Library, select an image, click "Edit Image", perform a crop or rotation, and save. Confirm the edit is applied successfully.
- General Admin: Edit a post and verify the page loads and saves correctly without any PHP notices or errors.
This ticket was mentioned in PR #12088 on WordPress/wordpress-develop by @Soean.
2 months ago
#11
This pull request makes a minor improvement to the documentation of the update_size method in the WP_Image_Editor_GDclaaa. The change clarifies that the $width and $height parameters can accept either an int or false as their value.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
This ticket was mentioned in PR #12119 on WordPress/wordpress-develop by @Soean.
2 months ago
#12
This PR removes a unused local variable $all_class_directives from the data_wp_class_processor() function.
Follow-up to r58327.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
This ticket was mentioned in PR #12144 on WordPress/wordpress-develop by @Soean.
2 months ago
#13
Replace Chr() and Ord() with their canonical lowercase forms chr() and ord().
This is flagged as a case-sensitivity violation by the upcoming PHP 8.6 RFC, which will emit E_DEPRECATED for function references that don't match their declared casing. Fixing it now keeps WordPress ahead of the deprecation.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
@Soean commented on PR #12144:
8 weeks ago
#16
@Soean commented on PR #12119:
8 weeks ago
#17
This ticket was mentioned in PR #12174 on WordPress/wordpress-develop by @Soean.
8 weeks ago
#18
Remove redundant arguments of add_filter(). Arguments match the parameters' default values.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
@Soean commented on PR #12174:
8 weeks ago
#20
@Soean commented on PR #12088:
7 weeks ago
#22
This ticket was mentioned in PR #12502 on WordPress/wordpress-develop by @mukesh27.
4 weeks ago
#25
Trac ticket: https://core.trac.wordpress.org/ticket/64897
## Use of AI Tools
@mukesh27 commented on PR #12502:
4 weeks ago
#26
Introduce in core-50760 / https://core.trac.wordpress.org/changeset/48609
@SergeyBiryukov commented on PR #12502:
4 weeks ago
#28
Thanks for the PR! Merged in r62727.
This ticket was mentioned in PR #12495 on WordPress/wordpress-develop by @Soean.
4 weeks ago
#29
The str_contains() function was introduced in PHP 8.0 and a polyfill is available in WordPress Core, making the intent of the check clearer than comparing the result of strpos() against false.
Follow-up to [62687]
Trac ticket: https://core.trac.wordpress.org/ticket/64897
This ticket was mentioned in PR #12417 on WordPress/wordpress-develop by @Soean.
4 weeks ago
#30
Replace $array[ count( $array ) - 1 ] constructs with the array_last() function (added in PHP 8.5, polyfilled in compat.php) for improved readability.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
This ticket was mentioned in PR #12296 on WordPress/wordpress-develop by @Soean.
4 weeks ago
#31
This change modernizes WP_REST_View_Config_Controller by replacing several isset( $x ) ? $x : $default ternary expressions with the equivalent null coalescing operator (??). The null coalescing operator uses the same isset() semantics — it returns the fallback when the key is either missing or null, so the behavior is identical to the previous code.
Follow-up to [61403]
Trac ticket: https://core.trac.wordpress.org/ticket/64897
This ticket was mentioned in PR #12602 on WordPress/wordpress-develop by @Soean.
3 weeks ago
#32
## Description
Replaces a handful of verbose isset() guard patterns with the null coalescing operator (??):
// Before if ( isset( $x ) ) { return $x; } else { return $default; } // After return $x ?? $default;
Both forms are functionally identical; ?? is shorter and clearer.
## Notes
- No behavior change; PHP's minimum version already supports
??.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
@westonruter commented on PR #12417:
3 weeks ago
#33
Nice thing about this is it is resilient against the possibility of not getting the actual last item in the array if the array is not a list, such as if the integer-indexed array becomes sparse: https://3v4l.org/cMG4N#v8.5.8
This ticket was mentioned in PR #12725 on WordPress/wordpress-develop by @westonruter.
12 days ago
#34
Trac ticket: https://core.trac.wordpress.org/ticket/64897
Correction: This was intended for #64898
@westonruter commented on PR #12725:
11 days ago
#35
@luisherranz Would you please push up commits to this branch that apply your suggestions?
Another option to consider would be to replicate in PHP what JavaScript's
String()does. An object becomes[object Object], an array becomes a comma join, and INF and NAN become"Infinity"and"NaN", although I'm not sure if, especially the[object Object]part, would make much sense.
IMO, it would be better to have a warning so that the author would be more readily discover their usage error.
@SergeyBiryukov commented on PR #12602:
10 days ago
#37
Thanks for the PR! Merged in r62895.
@westonruter commented on PR #12725:
9 days ago
#38
This is a bit unexpected to me , but it also is the behavior in trunk, which I just realized.
@luisherranz I think I got it. How about 0d8e02388419a7fc21e9d08c96ef6f61f6483ec4?
@SergeyBiryukov commented on PR #12296:
9 days ago
#40
Thanks for the PR! Merged in r62949.
@luisherranz commented on PR #12725:
9 days ago
#41
@luisherranz I think I got it. How about https://github.com/WordPress/wordpress-develop/commit/0d8e02388419a7fc21e9d08c96ef6f61f6483ec4?
Looks great! I'll prepare the fix to sync it in Gutenberg, thank you very much! 🙂
@luisherranz commented on PR #12725:
8 days ago
#42
Gutenberg PR for the syntax backport here:
@Soean commented on PR #12417:
8 days ago
#44
Comitted in https://core.trac.wordpress.org/changeset/62956
@SergeyBiryukov commented on PR #12495:
6 days ago
#46
Thanks for the PR! Merged in r62964.
This ticket was mentioned in PR #12858 on WordPress/wordpress-develop by @Soean.
3 days ago
#47
## Description
composer run format currently reports two Generic.Formatting.MultipleStatementAlignment warnings. This PR applies the auto-fixes so that a clean checkout of trunk passes without pending changes.
## Warnings
FILE: src/wp-admin/includes/class-wp-users-list-table.php 638 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space FILE: src/wp-includes/pluggable.php 2379 | WARNING | [x] Equals sign not aligned correctly; expected 1 space but found 2 spaces
## When were these introduced?
Both were introduced during the 7.1 development cycle, so no released version of WordPress is affected.
| File | Introduced in | Ticket |
|---|---|---|
src/wp-admin/includes/class-wp-users-list-table.php | r62838 – *Administration: Use post title column as table header in post lists* (2026-07-23) | #32892 |
src/wp-includes/pluggable.php | r62590 – *Notifications: Remove the username from the new user notification email* (2026-06-30) | #63085 |
In r62838 the new $tag assignment was added directly above an existing $row .= assignment without aligning the block. In r62590 the line above $message was removed, leaving $message with the alignment padding of a block that no longer exists.
These are whitespace-only changes, so no functional testing is required.
Trac ticket: https://core.trac.wordpress.org/ticket/64897
@SergeyBiryukov commented on PR #12858:
3 days ago
#49
Thanks for the PR! Merged in r63027.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Renames abbreviated local variables in wp-admin media and file handling code to follow WordPress Naming Conventions:
$ext→$extension$ext_type→$extension_type$id3data→$id3_dataFollow-up to [61224].