Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#59731 closed enhancement (invalid)

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

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

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 3 years ago.
Patch added!

Download all attachments as: .zip

Change History (7)

@mihirdev21
3 years ago

Patch added!

#1 @mihirdev21
3 years ago

  • Keywords has-patch added; needs-patch removed

#2 follow-up: @SergeyBiryukov
3 years 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
3 years ago

  • Resolution → invalid
  • Status new → 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
3 years 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
3 years ago

  • Focuses php-compatibility removed

#6 @swissspidy
3 years ago

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