[wp-trac] [WordPress Trac] #59731: Count function inside of the loop not allowed as per phpcs rules

WordPress Trac noreply at wordpress.org
Wed Oct 25 12:18:54 UTC 2023


#59731: Count function inside of the loop not allowed as per phpcs rules
-------------------------+-------------------------------------------------
 Reporter:  mihirdev21   |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:  invalid
 Keywords:  has-patch    |     Focuses:  coding-standards, php-
                         |  compatibility
-------------------------+-------------------------------------------------

Comment (by jrf):

 Also note that the rule to disallow/discourage using functions like
 `count()` in a loop condition is a rule which does not apply to WP Core.
 It is not part of the formal coding standards.

 It is a recommendation/best practice rule which is in the `WordPress-
 Extra` ruleset, which should not be used for WP Core.

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


More information about the wp-trac mailing list