• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPCSStandards / PHP_CodeSniffer / 7425037880
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: feature/fixer-conflict/PSR12.Functions.ReturnTypeDeclaration
DEFAULT BRANCH: master
Ran 05 Jan 2024 05:52PM UTC
Jobs 3
Files 257
Run time 26s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Jan 2024 05:50PM UTC coverage: 64.502% (+0.004%) from 64.498%
7425037880

push

github

jrfnl
Generic/ForLoopShouldBeWhileLoop: fix E_DEPRECATED error

This commit fixes an issue in the sniff that could result in the following E_DEPRECATED
error when running PHP 8.3:

```
Decrement on type null has no effect, this will change in the next major version of PHP

src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php:65
```

This sniff relies on finding the position of the open and closing
parentheses for a given `for` loop. However, the problem was that there was
no defensive code for cases when the closing parenthesis is missing. The
sniff would still work when running PHP >= 8.2, but on PHP 8.3 it would
throw the deprecated message above.

This would happen because since there is no closing parenthesis `$end` is set to null,
and $next <= $end always evaluates to false
(https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/84acf4e56/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php#L74).

The issue was fixed by bailing early if the closing parenthesis is
missing. A test with a `for` loop without the closing parenthesis was added.

15249 of 23641 relevant lines covered (64.5%)

6.05 hits per line

Jobs
ID Job ID Ran Files Coverage
1 php-7.2-custom-ini-false - 7425037880.1 05 Jan 2024 05:52PM UTC 257
60.53
GitHub Action Run
2 php-8.0-custom-ini-true - 7425037880.2 05 Jan 2024 05:52PM UTC 257
63.59
GitHub Action Run
3 php-8.3-custom-ini-false - 7425037880.3 05 Jan 2024 05:52PM UTC 257
63.64
GitHub Action Run
Source Files on build 7425037880
  • Tree
  • List 257
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #7425037880
  • b54d8eec on github
  • Prev Build on 4.0 (#7421829601)
  • Next Build on 4.0 (#7430747567)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc