Make WordPress Core

Opened 9 months ago

Closed 5 weeks ago

Last modified 4 weeks ago

#63168 closed task (blessed) (fixed)

Coding Standards fixes for WP 6.9

Reported by: desrosj's profile desrosj Owned by:
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests changes-requested
Focuses: coding-standards Cc:

Description

Previously:

Attachments (1)

search_term_global.diff (14.9 KB) - added by westonruter 2 months ago.

Download all attachments as: .zip

Change History (73)

#1 @SergeyBiryukov
9 months ago

In 60094:

Coding Standards: Remove a one-time $sql variable in WP_Importer methods.

This allows the $wpdb::prepare() calls to be picked up correctly by PHPCS.

Follow-up to [14760].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

#2 @SergeyBiryukov
9 months ago

In 60096:

Coding Standards: Remove a one-time $sql variable in network_domain_check().

This allows the $wpdb::prepare() call to be picked up correctly by PHPCS.

Follow-up to [28712].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

#3 @SergeyBiryukov
9 months ago

In 60101:

Coding Standards: Remove a one-time $sql variable in Edit Site form.

This allows the $wpdb::prepare() call to be picked up correctly by PHPCS.

Follow-up to [28712].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

#4 @SergeyBiryukov
9 months ago

In 60103:

Coding Standards: Move $wp_db_version declaration to the top of wp-admin/network/upgrade.php.

Includes removing a duplicate DocBlock.

Follow-up to [12603], [25191], [60095].

See #63168.

#5 @SergeyBiryukov
9 months ago

In 60106:

Coding Standards: Use $wpdb::prepare() in wp-admin/maint/repair.php.

Follow-up to [11902], [12092], [13224], [13229].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

#6 @SergeyBiryukov
8 months ago

In 60131:

Coding Standards: Move wp_unique_id_from_values() next to wp_unique_id() and wp_unique_prefixed_id(), for consistency.

Follow-up to [60038].

See #63168.

#7 @hardik2221
8 months ago

Hello

I've submitted a PHPCS-related patch on Below ticket.

Ticket : https://core.trac.wordpress.org/ticket/63351

Kindly also take a moment to review this ticket

Thank you

Version 0, edited 8 months ago by hardik2221 (next)

#8 @SergeyBiryukov
7 months ago

In 60231:

Coding Standards: Correct WP_PHPMailer::setLanguage() method name case.

PHP function names are not case-sensitive, so this aims to bring consistency with the parent method.

Includes removing a one-time variable.

Follow-up to [27385], [59592].

See #63168.

This ticket was mentioned in Slack in #core by joemcgill. View the logs.


7 months ago

#10 @SergeyBiryukov
6 months ago

In 60290:

Coding Standards: Remove redundant check in WP_Customize_Widgets.

isset() is enough to check for the property existence here.

Follow-up to [60279].

See #63168.

#11 @SirLouen
6 months ago

  • Resolution set to invalid
  • Status changed from new to closed

#45939: One <br /> left.

#12 @SirLouen
6 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#13 @SergeyBiryukov
5 months ago

In 60477:

Coding Standards: Reorder width and height for consistency in wp_get_attachment_image().

Includes correcting the placement of the filter_wp_get_attachment_image() helper function in unit tests.

Follow-up to [60415], [60476].

See #63168.

#14 @jeremyfelt
4 months ago

In 60663:

Coding Standards: Properly align variable assignment in WP_Block

Removes a new line added as part of [60611] which impacted alignment of variable assignments in process_block_bindings().

See #63168.

#15 @peterwilsoncc
3 months ago

In 60779:

Coding Standards: Rename arguments in comment_type().

Rename the arguments in comment_type() to use underscore separators per coding standards and to add vowels for clarity.

"Pingback" and "Trackback" in the variable names are left unchanged as they are concatenated for display to site owners.

See #63168.

#16 @SergeyBiryukov
3 months ago

In 60797:

Coding Standards: Move specific sniff exclusions for PHPMailer to the config file.

This aims to make future updates of the library easier.

Follow-up to [48045], [51635].

See #63168.

#17 @SergeyBiryukov
3 months ago

In 60800:

Coding Standards: Move specific sniff exclusions for getID3 to the config file.

This aims to make future updates of the library easier.

Follow-up to [47735], [47737], [47902].

See #63168.

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


3 months ago
#18

  • Keywords has-patch added

Format corrections in this commit is the produce of executing the composer format command of wordpress-develop (/composer.json > scripts > format) on the wordpress-develop codebase.

#19 @SergeyBiryukov
3 months ago

In 60808:

Coding Standards: Correct alignment in _wp_scan_utf8().

This resolves a WPCS warning:

Equals sign not aligned with surrounding statements

so that the output of composer format is clean.

Follow-up to [60768].

Props paulbonneau.
See #63168.

@SergeyBiryukov commented on PR #10076:


3 months ago
#20

Thanks for the PR! Merged in r60808.

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


2 months ago
#21

  • Keywords has-unit-tests added

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

This PR makes minor improvements to the documentation in the test suite for comment template rendering. Specifically, it adds a blank line between the @ticket and @covers annotations in several test methods, also correct indentation for inline comment.

@SergeyBiryukov commented on PR #10111:


2 months ago
#22

Thanks for the PR! Merged in r60889.

#24 @SergeyBiryukov
2 months ago

In 60901:

Code Modernization: Use str_contains() in get_shortcode_tags_in_content().

str_contains() was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for str_contains() on PHP < 8.0 as of WordPress 5.9.

Follow-up to [52039], [55988], [56245], [56838], [60900].

See #63168.

#25 @SergeyBiryukov
2 months ago

In 60923:

Coding Standards: Rename $c to $blog_count in wp-admin/admin.php.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to mu:1940, [12712].

Props costdev, mukesh27.
See #63168.

#26 follow-up: @SergeyBiryukov
2 months ago

In 60924:

Coding Standards: Rename $s to $search_term in wp-admin/plugins.php.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [15697].

Props costdev, mukesh27.
See #63168.

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


2 months ago
#27

Renames the variables used for local instances of $this->query_vars in WP_Query.

The local references currently use the abbreviations $q or $qv rather than a meaningful name, this changes the local references to $query_vars` for consistency and clarity/self documenting.

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

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


2 months ago
#28

Renames the variables used for local instances of $this->query_vars in WP_Query.

The local references currently use the abbreviations $q or $qv rather than a meaningful name, this changes the local references to $query_vars` for consistency and clarity/self documenting.

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

#29 @peterwilsoncc
2 months ago

In 60927:

Coding Standards: Rename abbreviated variables in WP_Query.

Renames the locally scoped references to WP_Query::$query_vars from $q/$qv to $query_vars for clarity per the coding standards' naming conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See #63168.

#31 @SergeyBiryukov
2 months ago

In 60928:

Coding Standards: Use more meaningful variable names in Plugin Editor.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [10879], [41721].

Props costdev, mukesh27.
See #63168.

#32 in reply to: ↑ 26 @westonruter
2 months ago

  • Keywords changes-requested added

Replying to SergeyBiryukov:

In 60924:

Coding Standards: Rename $s to $search_term in wp-admin/plugins.php.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [15697].

Props costdev, mukesh27.
See #63168.

The $s global is still being used elsewhere:

$ ack 'global(\s|.+?, )\$s(,|;)' src/wp-admin/
src/wp-admin/includes/class-wp-ms-sites-list-table.php
69:             global $mode, $s, $wpdb;

src/wp-admin/includes/class-wp-links-list-table.php
51:             global $cat_id, $s, $orderby, $order;

src/wp-admin/includes/class-wp-ms-themes-list-table.php
100:            global $status, $totals, $page, $orderby, $order, $s;
548:            global $status, $page, $s;

src/wp-admin/includes/class-wp-plugins-list-table.php
91:             global $status, $plugins, $totals, $page, $orderby, $order, $s;
375:            global $s;
724:            global $status, $page, $s, $totals

On /wp-admin/plugins.php, for example, there is currently an error (as noted by @mukesh27 in Slack):

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/wp-admin/includes/class-wp-plugins-list-table.php on line 297

Many more replacements would be needed, for example search_term_global.diff

I worry about back-comapt problems for this change, however. There are close to two hundred plugins that are looking at the $s global: https://wpdirectory.net/search/01K7FVTRKDN6DTVNK82CYK72ZB

I think [60924] needs to be reverted.

This ticket was mentioned in Slack in #core by westonruter. View the logs.


2 months ago

#34 @SergeyBiryukov
2 months ago

In 60929:

Coding Standards: Revert the renaming of $s variable in wp-admin/plugins.php.

The $s global needs to remain for backward compatibility.

Follow-up to [60924].

Props westonruter, mukesh27.
See #63168.

#35 @SergeyBiryukov
2 months ago

In 60932:

Coding Standards: Use more meaningful variable names in Theme Editor.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [41721], [60928].

See #63168.

#36 @SergeyBiryukov
8 weeks ago

In 60967:

Coding Standards: Use more meaningful variable names in Media Library.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [31037], [31041], [31562].

Props costdev, mukesh27.
See #63168.

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


8 weeks ago
#37

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#38

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#39

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $sbname to $sidebar_name.
  • $sbvalue to $sidebar_data.
  • $j to $widget_count.
  • $i to $sidebar_index.
  • $sb to $sidebar.
  • $key to $sidebar_id.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#40

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $i to $submenu_index.
  • $cap to $capability.
  • $tax to $taxonomy.
  • Several $awaiting_mod_* to $awaiting_moderation_*.
  • Several $ptype_* to $post_type_*.
  • $types to $post_types.
  • $appearance_cap to $appearance_capability.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#41

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $r to $edit_result.
  • $ext to $extension.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#42

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $q to $query_string.
  • $vars to $query_vars.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#43

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $h to $header.

Not touched:

  • $oitar - This is $ratio backwards. Props @SergeyBiryukov.
    • This is also used as a hidden form field's name.
    • Not touched by this PR. If there's a desire to change it, let's change it on its own after auditing for BC.

There are a couple of variables I'd like some input on:

  • $dst_height - This could be $dest_height, but that doesn't seem like a worthwhile change. Suggestions?
  • $dst_width - See above.
  • Edit Feedback received. No change to these.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#44

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $r to $upgrade_data.
  • $res to $connected.
  • $pluginfiles to $plugin_files - Per naming conventions, separate words via underscores.
  • $info to $new_plugin_data.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

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


8 weeks ago
#45

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $post_ID to $post_id. - "Use lowercase letters in variable, action/filter, and function names"
  • $ext_type to $extension_type.
  • $ext to $extension.
  • $id3data to $id3_data. - "Separate words via underscores."
  • $msg to $message.
  • $sb to $sidebar.
  • $alt to $alternate.
  • $pid to $post_id.
  • $menu_obj to $menu_object.
  • $noparents to $no_parents. - "Separate words via underscores."
  • $sup to $supplemental.
  • $cat_id to $category_id.
  • $cat_name to $category_name.
  • $out to $output.
  • $r to $edit_result.
  • $t to $taxonomy.
  • $u to $update_result.
  • $r to $result.
  • $response to $response_data.
  • $x to $response.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

#46 @SergeyBiryukov
8 weeks ago

In 60970:

Coding Standards: Use more meaningful variable names in Custom Image Header.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

Follow-up to [27497], [27849].

Props costdev, mukesh27.
See #63168.

@SergeyBiryukov commented on PR #3195:


8 weeks ago
#47

Thanks for the PR! Merged in r60970.

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


8 weeks ago
#48

Per naming conventions, don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

See PHP Coding Standards - Naming Conventions.

This PR includes renaming of the following variables:

  • $r to $upgrade_data.
  • $res to $connected.
  • $info to $new_theme_data.

Trac ticket:
https://core.trac.wordpress.org/ticket/63168
https://core.trac.wordpress.org/ticket/55647

#49 @peterwilsoncc
8 weeks ago

In 60979:

Themes: Remove caching todo from get_uploaded_header_images().

Remove the note to introduce caching to get_uploaded_header_images() as caching has since been introduced to WP_Query and therefore get_posts(). The comment is out of date.

Props audrasjb, desrosj, flixos90, mukesh27, pbearne, pbiron, sachinrajcp123, sergeybiryukov, swissspidy, westonruter, whyisjake.
See #49446, #63168.

#50 @peterwilsoncc
8 weeks ago

In 60980:

Menus: Remove caching todo from wp_nav_menu_item_post_type_meta_box().

Remove the note to introduce caching to wp_nav_menu_item_post_type_meta_box() as caching has since been introduced to WP_Query and therefore get_posts(). The comment is out of date.

See #63168.

#51 @SergeyBiryukov
8 weeks ago

In 60997:

Coding Standards: Use more meaningful variable names in Plugin Upgrader.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

This commit includes renaming of the following variables:

  • $r to $upgrade_data.
  • $res to $connected.
  • $pluginfiles to $plugin_files — Per naming conventions, separate words via underscores.
  • $info to $new_plugin_data.

Follow-up to [6779], [8550], [9141], [11005], [12157], [18618], [56525].

Props costdev, mukesh27.
See #63168.

#52 @SergeyBiryukov
8 weeks ago

In 61028:

Coding Standards: Use more meaningful variable names in Theme Upgrader.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

This commit includes renaming of the following variables:

  • $r to $upgrade_data.
  • $res to $connected.
  • $info to $new_theme_data.

Follow-up to [8989], [11005], [13686], [18618], [20268], [57252].

Props costdev, mukesh27.
See #63168.

@SergeyBiryukov commented on PR #3197:


8 weeks ago
#53

Thanks for the PR! Merged in r60997.

@SergeyBiryukov commented on PR #3196:


8 weeks ago
#54

Thanks for the PR! Merged in r61028.

#57 @jorbin
8 weeks ago

In 61035:

Coding Standards: Use preincrment.

Sorry Dennis.

Introduced in [60939].
See #63168.

#58 @jorbin
8 weeks ago

In 61036:

Coding Standards: Fix blank spaces.

Nice to meet you, where you been?

See #63168.

#59 @westonruter
7 weeks ago

In 61044:

Coding Standards: Rename abbreviated variable in WP_Query code comment.

This was missed as part of renaming $q to $query_vars.

Follow-up to [60927].

Props westonruter.
See #63168.

@jorbin commented on PR #10379:


7 weeks ago
#60

Committed in 61036

@jorbin commented on PR #10378:


7 weeks ago
#61

Committed in 61035

#62 @westonruter
6 weeks ago

In 61102:

Coding Standards: Improve formatting of phpdoc for params in wpdb class.

Props truptikanzariya, rollybueno.
See #63168.
Fixes #64160.

#63 @jorbin
6 weeks ago

In 61138:

Coding Standards: Fix alignment

In [61089], auth_callback was added which is causing phpcs to complain about the alignment with the other arguments in the array.

Follow-up to [61089] and [61036].

See #64153, #63168.

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


6 weeks ago
#64

Add all the commits made during 6.9 that are blank space only commits.

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

#65 @jorbin
5 weeks ago

In 61143:

Coding Standards: Ignore blank space commits while blaming.

Each of these commits during 6.9 only changed blank spaces. Excluding them helps to reduce the noise when doing code archaeology.

Follow-up to [60074], [60109], [60664], [60780], [60808], [60816], [61036], [61075], [61087], [61138].o

Props jorbin, peterwilsoncc.
See #63168.

@jorbin commented on PR #10467:


5 weeks ago
#66

Thanks @peterwilsoncc!

This was committed in https://core.trac.wordpress.org/changeset/61143

#67 @SergeyBiryukov
5 weeks ago

In 61187:

Coding Standards: Use more meaningful variable names in Classic Widgets screen.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

This commit includes renaming of the following variables:

  • $sbname to $sidebar_name.
  • $sbvalue to $sidebar_data.
  • $j to $widget_count.
  • $i to $sidebar_index.
  • $sb to $sidebar.
  • $key to $sidebar_id.

Follow-up to [10912], [11009], [11427], [26285], [50997].

Props costdev, mukesh27.
See #63168.

@SergeyBiryukov commented on PR #3191:


5 weeks ago
#68

Thanks for the PR! Merged in r61187.

#69 @desrosj
5 weeks ago

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

With RC1 in less than 24 hours and the branching of 6.9 immanent, I've created #64226 for the 7.0 release and will close this one out.

If there are further changes required for 6.9, this can be reopened or referenced in the commit message.

Last edited 4 weeks ago by SergeyBiryukov (previous) (diff)

#70 @SergeyBiryukov
5 weeks ago

In 61200:

Coding Standards: Use more meaningful variable names in Admin Menu.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

This commit includes renaming of the following variables:

  • $i to $submenu_index.
  • $cap to $capability.
  • $tax to $taxonomy.
  • Several $awaiting_mod_* to $awaiting_moderation_*.
  • Several $ptype_* to $post_type_*.
  • $types to $post_types.
  • $appearance_cap to $appearance_capability.

Follow-up to [12597], [14654], [21199], [23871], [33723], [33867].

Props costdev, SergeyBiryukov.
See #63168.

@SergeyBiryukov commented on PR #3192:


4 weeks ago
#71

Thanks for the PR! Merged in r61200.

@SergeyBiryukov commented on PR #3198:


4 weeks ago
#72

Thanks for the PR! Merged in r61224.

Note: See TracTickets for help on using tickets.