[wp-trac] [WordPress Trac] #59777: WP admin : Use Yoda condition

WordPress Trac noreply at wordpress.org
Tue Oct 31 19:15:47 UTC 2023


#59777: WP admin : Use Yoda condition
----------------------------+-------------------------------
 Reporter:  ashokrd2013     |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  coding-standards
----------------------------+-------------------------------

Comment (by jrf):

 @ashokrd2013 Yoda conditions are not needed when neither side of the
 condition is a variable.

 Also see: https://developer.wordpress.org/coding-standards/wordpress-
 coding-standards/php/#yoda-conditions

 As for the compiler argument, this is one I've never heard before and
 which I find surprising as these comparison operators are non-associative.
 I'd be interested to read more about this. Could you please add the source
 of this information ?

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


More information about the wp-trac mailing list