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

PHPCSStandards / PHP_CodeSniffer / 19217180359
79%
master: 79%

Build:
Build:
LAST BUILD BRANCH: feature/fixer-conflict/PSR12.Functions.ReturnTypeDeclaration
DEFAULT BRANCH: master
Ran 10 Nov 2025 12:49AM UTC
Jobs 8
Files 265
Run time 1min
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: 78.838% (+0.04%) from 78.799%
19217180359

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)

67 of 67 new or added lines in 1 file covered. (100.0%)

19771 of 25078 relevant lines covered (78.84%)

96.81 hits per line

Jobs
ID Job ID Ran Files Coverage
1 os-windows-latest-php-7.2-custom-ini-false - 19217180359.1 10 Nov 2025 12:49AM UTC 265
2.14
GitHub Action Run
2 os-ubuntu-latest-php-7.2-custom-ini-false - 19217180359.2 10 Nov 2025 12:55AM UTC 265
75.72
GitHub Action Run
3 cbf-os-ubuntu-latest-ubuntu-latest-php-8.4-custom-ini-false - 19217180359.3 10 Nov 2025 12:53AM UTC 265
2.34
GitHub Action Run
4 os-windows-latest-php-8.4-custom-ini-false - 19217180359.4 10 Nov 2025 12:49AM UTC 265
2.69
GitHub Action Run
5 os-ubuntu-latest-php-8.4-custom-ini-false - 19217180359.5 10 Nov 2025 12:53AM UTC 265
76.62
GitHub Action Run
6 cbf-os-ubuntu-latest-ubuntu-latest-php-7.2-custom-ini-false - 19217180359.6 10 Nov 2025 12:55AM UTC 265
1.3
GitHub Action Run
7 cbf-os-ubuntu-latest-ubuntu-latest-php-8.4-custom-ini-true - 19217180359.7 10 Nov 2025 12:53AM UTC 265
2.34
GitHub Action Run
8 os-ubuntu-latest-php-8.4-custom-ini-true - 19217180359.8 10 Nov 2025 12:53AM UTC 265
76.52
GitHub Action Run
Source Files on build 19217180359
  • Tree
  • List 265
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #19217180359
  • 93979308 on github
  • Prev Build on 4.x (#19152079645)
  • Next Build on 4.x (#19236500365)
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

© 2025 Coveralls, Inc