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

PHPCSStandards / PHP_CodeSniffer / 19217180359 / 5
79%
master: 79%

Build:
Build:
LAST BUILD BRANCH: catch-per-3.0
DEFAULT BRANCH: master
Ran 10 Nov 2025 12:55AM UTC
Files 265
Run time 8s
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

10 Nov 2025 12:48AM UTC coverage: 76.623% (+0.04%) from 76.581%
19217180359.5

push

github

web-flow
Squiz/SwitchDeclaration: bug fix - fixer conflict for single line code (#1315)

While working on something else, I realized that the `Squiz.ControlStructures.SwitchDeclaration` sniff did not take into account that the "code under scan" could potentially be written to have various "parts" of a switch case/default structure on a single line.

This meant that, in that case, the sniff would have a fixer conflict with itself.
It would basically keep adding indentation whitespace for case/default/breaking statements not having the right indentation, but as it never added a new line _before_ the indentation, the indentation would still be incorrect in the next loop.

Fixed now by adding a number of extra checks to the sniff:
* `'ContentBefore' .$type` - which checks if there is anything but indentation whitespace, before a `case` or `default` keyword.
* `'ContentBeforeBreak'` - which checks if there is anything but indentation whitespace, before a `break/return` (etc) keyword.
* `'ContentAfter' .$type` - which checks if there is anything but a trailing comment, after a `case` or `default` statement.

The sniff also contains a couple of checks which verify the number of blank lines above/below certain statements. Those also didn't take into account that the count of the "lines between" may be zero, i.e. the code "after" being on the same line as the starting point for the check.
Those situations should now largely be fixed with the new lines being added via the `Content[Before|After]*` error codes.
For all other cases, the fixer code for the "number of blank lines" checks has been updated to handle trailing comments better, not leave trailing whitespace behind and not get into a fixer conflict with the new checks.

Notes:
* All fixers added/updated have been set up to prevent leaving trailing whitespace behind.
* The "fixed" code for one pre-existing test with a trailing comment has changed. In my opinion, the new "fixed" version is more correct, because:
   ... (continued)

19070 of 24888 relevant lines covered (76.62%)

32.21 hits per line

Source Files on job os-ubuntu-latest-php-8.4-custom-ini-false - 19217180359.5
  • Tree
  • List 265
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 19217180359
  • 93979308 on github
  • Prev Job for on 4.x (#19152079645.5)
  • Next Job for on 4.x (#19236500365.6)
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