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

PHPCSStandards / PHP_CodeSniffer / 13902484955
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 17 Mar 2025 02:51PM UTC
Jobs 8
Files 263
Run time 2min
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

17 Mar 2025 02:50PM UTC coverage: 77.547% (+0.008%) from 77.539%
13902484955

push

github

jrfnl
Ruleset: handle invalid sniffs more graciously

As things were, a ruleset loading an invalid sniff - a sniff which doesn't implement the `Sniff` interface and is missing either the `register()` or `process()` method, or both -, would result in fatal errors which are unfriendly to the end-user.

Now, while this will hopefully be a very rare occurrence and should no longer be possible as of PHPCS 4.0, which intends to remove support for sniffs not implementing the `Sniff` interface, I still believe it prudent to show more user-friendly and more informative error messages to the end-user until that time.

This commit implements this and executes step 2 to address issue 694..

Includes tests.

Output of commands involving various invalid sniffs **before** this PR:

```
$ phpcs -ps . --standard=./tests/Core/Ruleset/RegisterSniffsRejectsInvalidSniffNoImplementsNoRegisterTest.xml

Fatal error: Uncaught Error: Call to undefined method TestStandard\Sniffs\InvalidSniffError\NoImplementsNoRegisterSniff::register() in path/to/PHP_CodeSniffer/src/Ruleset.php:1505
Stack trace:
  thrown in path/to/PHP_CodeSniffer/src/Ruleset.php on line 1505
```

```
$ phpcs -ps . --standard=./tests/Core/Ruleset/RegisterSniffsRejectsInvalidSniffNoImplementsNoProcessTest.xml

PHP_CodeSniffer version 3.11.1 (stable) by Squiz and PHPCSStandards

Fatal error: Uncaught Error: Call to undefined method TestStandard\Sniffs\InvalidSniffError\NoImplementsNoProcessSniff::process() in path/to/PHP_CodeSniffer/src/Files/File.php:519
Stack trace:
  thrown in path/to/PHP_CodeSniffer/src/Files/File.php on line 519
```

```
$ phpcs -ps . --standard=./tests/Core/Ruleset/RegisterSniffsRejectsInvalidSniffNoImplementsNoRegisterOrProcessTest.xml

PHP_CodeSniffer version 3.11.1 (stable) by Squiz and PHPCSStandards

Fatal error: Uncaught Error: Call to undefined method TestStandard\Sniffs\InvalidSniffError\NoImplementsNoRegisterOrProcessSniff::register() in path/to/PHP_CodeSniffer/src/Ruleset.php:1505
Stack... (continued)

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

19303 of 24892 relevant lines covered (77.55%)

76.75 hits per line

Jobs
ID Job ID Ran Files Coverage
1 os-ubuntu-latest-php-8.1-custom-ini-true - 13902484955.1 17 Mar 2025 02:54PM UTC 263
76.06
GitHub Action Run
2 os-windows-latest-php-7.2-custom-ini-false - 13902484955.2 17 Mar 2025 02:51PM UTC 263
2.08
GitHub Action Run
3 os-ubuntu-latest-php-7.2-custom-ini-false - 13902484955.3 17 Mar 2025 02:56PM UTC 263
73.88
GitHub Action Run
4 cbf-os-ubuntu-latest-ubuntu-latest-php-7.2-custom-ini-false - 13902484955.4 17 Mar 2025 02:56PM UTC 263
0.81
GitHub Action Run
5 os-ubuntu-latest-php-8.4-custom-ini-false - 13902484955.5 17 Mar 2025 02:54PM UTC 263
76.04
GitHub Action Run
6 cbf-os-ubuntu-latest-ubuntu-latest-php-8.4-custom-ini-false - 13902484955.6 17 Mar 2025 02:54PM UTC 263
1.89
GitHub Action Run
7 os-windows-latest-php-8.4-custom-ini-false - 13902484955.7 17 Mar 2025 02:51PM UTC 263
2.62
GitHub Action Run
8 cbf-os-ubuntu-latest-ubuntu-latest-php-8.1-custom-ini-true - 13902484955.8 17 Mar 2025 02:54PM UTC 263
1.89
GitHub Action Run
Source Files on build 13902484955
  • Tree
  • List 263
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #13902484955
  • 0392b2f2 on github
  • Prev Build on 4.0 (#13902315391)
  • Next Build on 4.0 (#13906880974)
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