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

WordPress Trac noreply at wordpress.org
Fri Jul 12 01:58:35 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 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).

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


More information about the wp-trac mailing list