Make WordPress Core

Opened 8 months ago

Closed 5 months ago

#61607 closed task (blessed) (fixed)

Coding Standards fixes for WP 6.7

Reported by: hellofromtonya's profile hellofromTonya Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: coding-standards Cc:

Description

Previously:

Change History (17)

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


7 months ago
#1

  • Keywords has-patch added

I'm not sure if there is a generic ticket for code quality improvements so will hold off creating a ticket until I've done some digging.

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

#2 @peterwilsoncc
7 months ago

In 58878:

Code Quality: Clarify variable names in dependency classes.

Renames several variables in the WP_Scripts and WP_Styles classes to clarify their purpose for developers reading the code.

Props peterwilsoncc, sergeybiryukov.
See #61607.

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


7 months ago
#5

Maybe this PR can be included in 6.2, after being overseen in 6.0 and 6.1.

https://core.trac.wordpress.org/ticket/61607
https://core.trac.wordpress.org/ticket/56791

#6 @SergeyBiryukov
7 months ago

In 58888:

Coding Standards: Bring some consistency to setting up comment moderation links.

Follow-up to [7082], [7175], [9103], [10102], [11749], [12008], [12286], [32516].

Props kebbet.
See #61607.

@SergeyBiryukov commented on PR #2435:


7 months ago
#7

Thanks for the PR! Merged in r58888.

#8 @SergeyBiryukov
7 months ago

In 58938:

Coding Standards: Use a human-readable constant in the check for max memory limit.

Follow-up to [35286], [38011], [38015], [58937].

See #61607.

#10 @SergeyBiryukov
6 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 58994:

Coding Standards: Use strict comparison in wp-admin/includes/upgrade.php.

Follow-up to [725], [1575], [1975], [2037], [2966], [3670], [4738], [11958], [12776], [14080], [14485], [32378].

Props faisalahammad, mujuonly, aristath, poena, afercia, SergeyBiryukov.
Fixes #58041, #61607.

#11 @SergeyBiryukov
6 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#12 @SergeyBiryukov
6 months ago

In 58998:

Coding Standards: Use strict comparison in wp-includes/capabilities.php.

Follow-up to [2703], [3297], [3513], [6697], [14189], [25177], [27390], [38378], [38698], [39588], [48356], [48664].

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

#13 @peterwilsoncc
6 months ago

To avoid a repeat of #61749 from WordPress 6.6, any PRs making changes to strict compaisons will need:

  • anything that use wp_parse_args(): test that use both array and query string formatted arguments
  • anything that uses options: tests that pass/use the option as the expected type (eg, integer) and cast to a string to account for potential differences in type returned by get_option() depending on whether it is called with a warm cache immediatly after add|update_option() and a cold cache requiring a database query (See #32848 as one example of several)

@SergeyBiryukov commented on PR #3873:


6 months ago
#14

This will need tests before it can be merged:

Indeed, this is basically still a draft where I cherry-pick certain changes after a closer review, making sure they are covered by new or existing tests. I will investigate anything related to wp_parse_args() and WP_Query, thanks!

#15 @SergeyBiryukov
6 months ago

In 59066:

Coding Standards: Remove unused return value for WP_Object_Cache::__set().

This resolves a WPCS warning:

Assignments must be the first block of code on a line

Note: This is enforced by PHPCS 3.10.3.

Follow-up to [28521], [29146].

Props jrf.
See #62076, #61607.

#16 @SergeyBiryukov
5 months ago

In 59183:

Coding Standards: Use strict comparison in wp_list_comments().

Follow-up to [8962], [9296], [9424], [34735], [36157].

Props deepakrohilla, sabernhardt, aristath, poena, afercia, SergeyBiryukov.
Fixes #62169. See #61607.

#17 @desrosj
5 months ago

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

Closing out since RC1 is a few hours away. #62279 is now open for 6.8.

Note: See TracTickets for help on using tickets.