[wp-trac] [WordPress Trac] #54728: Coding Standards fixes for WP 6.0

WordPress Trac noreply at wordpress.org
Mon Mar 21 14:51:20 UTC 2022


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

Comment (by SergeyBiryukov):

 Replying to [comment:47 jrf]:
 > As for the changes from `array()` to `compact()`: '''this is a BC-break
 which should be reverted'''.
 > You are changing the array which is passed to the filters from a
 numerically indexed array to an associative array and any code which is
 hooked into those filters which was approaching the array using numeric
 indexes will now be broken.
 >
 > See: https://3v4l.org/gUWOB

 Thanks for reviewing the changes and noting this!

 I will address the first suggestion shortly.

 For second one, however, unless I'm missing something, [52974] did **not**
 replace `array()` with `compact()`, but only relocated the `compact()`
 call while removing the redundant `array()` at the same time. All of these
 arrays were associative before the change, not numerically indexed.

 As far as I can tell, there is no functional difference between this:
 {{{
 $array = compact( array( 'a', 'b' ) );
 }}}
 and this:
 {{{
 $array = compact( 'a', 'b' );
 }}}
 https://3v4l.org/5WRUs seems to confirm that.

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


More information about the wp-trac mailing list