#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)
Change History (7)
#2
follow-up:
↓ 3
@
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
@
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.phpis 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
@
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch added!