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

PHPCSStandards / PHP_CodeSniffer / 8583233066
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 06 Apr 2024 07:09PM UTC
Jobs 3
Files 259
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

06 Apr 2024 07:06PM UTC coverage: 72.354% (+0.002%) from 72.352%
8583233066

push

github

jrfnl
PSR2/ClassDeclaration: bug fix - prevent fixer conflict

Yet another one in the fixer conflict series.

When running the `Squiz` standard over all test case files, a fixer conflict between the `Squiz.Classes.ClassDeclaration`, which extends the `PSR2.Classes.ClassDeclaration` sniff, and the `Squiz.Commenting.InlineComment` sniff was discovered via the tests in the `tests\Core\Tokenizer\UndoNamespacedNameSingleTokenTest.inc` file for a code sample like this:
```php
class MyClass
    /* testExtendedFQN */
    extends \Vendor\Level\FQN
    /* testImplementsRelative */
    implements namespace\Name,
        /* testImplementsFQN */
        \Fully\Qualified,
        /* testImplementsUnqualified */
        Unqualified,
        /* testImplementsPartiallyQualified */
        Sub\Level\Name
{}
```

The conflict essentially comes down to the `PSR2.Classes.ClassDeclaration` sniff adding a new line between an inline comment (which is already on its own line) and the name of an interface being implemented, which the `Squiz.Commenting.InlineComment` sniff would then remove again.

Isolating the code sample even further, the conflict can be reproduced even without the `Squiz.Commenting.InlineComment` sniff.

The short of it was, that the `PSR2.Classes.ClassDeclaration` sniff did not take into account that there could be comments between the interface names in a multi-line `implements` and would then get its knickers in a twist.

Original errors for the code sample added in the test case file:
```
 302 | ERROR | [x] Only one interface may be specified per line in a multi-line implements declaration
     |       |     (PSR2.Classes.ClassDeclaration.InterfaceSameLine)
 310 | ERROR | [x] Only one interface may be specified per line in a multi-line implements declaration
     |       |     (PSR2.Classes.ClassDeclaration.InterfaceSameLine)
 316 | ERROR | [x] Only one interface may be specified per line in a multi-line implements declaration
     |       |     (PSR2.Classes... (continued)

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

17360 of 23993 relevant lines covered (72.35%)

55.29 hits per line

Jobs
ID Job ID Ran Files Coverage
1 php-8.1-custom-ini-true - 8583233066.1 06 Apr 2024 07:10PM UTC 259
70.85
GitHub Action Run
2 php-7.2-custom-ini-false - 8583233066.2 06 Apr 2024 07:10PM UTC 259
68.53
GitHub Action Run
3 php-8.3-custom-ini-false - 8583233066.3 06 Apr 2024 07:09PM UTC 259
70.83
GitHub Action Run
Source Files on build 8583233066
  • Tree
  • List 259
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #8583233066
  • 2c2f2439 on github
  • Prev Build on 4.0 (#8582975589)
  • Next Build on 4.0 (#8604248433)
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