[wp-trac] [WordPress Trac] #47678: Modernize/simplify current_user_can()

WordPress Trac noreply at wordpress.org
Fri Jul 12 02:14:18 UTC 2019


#47678: Modernize/simplify current_user_can()
-------------------------------------+-------------------------------------
 Reporter:  jrf                      |       Owner:  pento
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  5.3
Component:  Role/Capability          |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-unit-      |     Focuses:  performance, coding-
  tests commit                       |  standards
-------------------------------------+-------------------------------------

Comment (by jrf):

 Replying to [comment:20 pento]:
 > Technically it's only testing for `if ( 0 !== count( $args ) )` ? 😉
 >
 >
 > I'm okay with the assumed knowledge that the spread operator will ensure
 that `$args` will always be an array (which is a little new to the
 WordPress codebase), so a falsey test of `$args` is checking if that array
 is empty or not (which is a very common pattern in the WordPress
 codebase).


 Well, you know me, I'm just not a fan of implicit non-descript loose
 comparisons ;-)
 I've had to debug way too many issues with that:
 https://phpcheatsheets.com/test/general/

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


More information about the wp-trac mailing list