[wp-trac] [WordPress Trac] #58831: Coding Standards fixes for WP 6.4

WordPress Trac noreply at wordpress.org
Sat Sep 9 09:26:17 UTC 2023


#58831: Coding Standards fixes for WP 6.4
--------------------------------------+-------------------------------
 Reporter:  audrasjb                  |       Owner:  (none)
     Type:  task (blessed)            |      Status:  new
 Priority:  normal                    |   Milestone:  6.4
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  coding-standards
--------------------------------------+-------------------------------

Comment (by SergeyBiryukov):

 In [changeset:"56549" 56549]:
 {{{
 #!CommitTicketReference repository="" revision="56549"
 Coding Standards: Use pre-increment/decrement for stand-alone statements.

 Note: This is enforced by WPCS 3.0.0:

 1. There should be no space between an increment/decrement operator and
 the variable it applies to.
 2. Pre-increment/decrement should be favoured over post-
 increment/decrement for stand-alone statements. “Pre” will in/decrement
 and then return, “post” will return and then in/decrement. Using the “pre”
 version is slightly more performant and can prevent future bugs when code
 gets moved around.

 References:
 * [https://developer.wordpress.org/coding-standards/wordpress-coding-
 standards/php/#increment-decrement-operators WordPress PHP Coding
 Standards: Increment/decrement operators]
 * [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS:
 PR #2130 Core: add sniffs to check formatting of increment/decrement
 operators]

 Props jrf.
 See #59161, #58831.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58831#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list