[wp-trac] [WordPress Trac] #48142: Let's do some `phpcbf` cleanup...

WordPress Trac noreply at wordpress.org
Thu Sep 26 07:55:33 UTC 2019


#48142: Let's do some `phpcbf` cleanup...
--------------------------+------------------------
 Reporter:  whyisjake     |       Owner:  whyisjake
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  5.3
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------

Comment (by jrf):

 @garrett-eclipse pinged me to have a look at the patches here.

 Re: [46316] - this may lead to difficult to debug issues unless you are
 100% sure both sides of the comparison will always be numeric.
 Effectively, the change makes no difference to the code and it is still a
 loose type comparison, as the `(int)` cast is what PHP would do internally
 when using `!=`.

 So if a true strict type comparison is intended here, a string-based
 strict comparison should be used:
 {{{#!php
 <?php
 `if ( $cat_id !== (string) $category ) {
 }}}

 Also see: https://phpcheatsheets.com/compare/not_equal/

 Re: `CS-network.php.diff`: comments should use proper punctuation, i.e.
 start with a capital letter and end with a punctuation character, so this
 inline comment would not pass once the docs checks get activated.
 {{{#!php
 <?php
 activate_plugin( $path, '', true );  // $network_wide = true
 }}}

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


More information about the wp-trac mailing list