Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 10 months ago

#59731 closed enhancement (invalid)

Count function inside of the loop not allowed as per phpcs rules

Reported by: mihirdev21's profile mihirdev21 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: coding-standards Cc:

Description

I have checked the rss.php file and i discovered that the count function is not allowed in the loop as per phpcs rules so i have added two variables and updated the code

Attachments (1)

59731.patch (976 bytes) - added by mihirdev21 14 months ago.
Patch added!

Download all attachments as: .zip

Change History (7)

@mihirdev21
14 months ago

Patch added!

#1 @mihirdev21
14 months ago

  • Keywords has-patch added; needs-patch removed

#2 follow-up: @SergeyBiryukov
14 months ago

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Please note that wp-includes/rss.php is a former external library (MagpieRSS). It does not follow the WordPress coding standards, which is why it is excluded from PHPCS checks.

#3 in reply to: ↑ 2 @mihirdev21
14 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to SergeyBiryukov:

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Please note that wp-includes/rss.php is a former external library (MagpieRSS). It does not follow the WordPress coding standards, which is why it is excluded from PHPCS checks.

Hello there @SergeyBiryukov
got it...thank you so much for the quick reply! Have a great rest of the day! : )

#4 @jrf
14 months ago

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.

#5 @jrf
14 months ago

  • Focuses php-compatibility removed

#6 @swissspidy
10 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.