Closed stefanfisk closed 4 years ago
@stefanfisk thanks for reporting.
I've tried to investigate that issue and created a file with content you've posted and run just the failing sniff. All is good for me, and there is no error.
From the logs you are attaching it looks like one of your autoloaders throws exception when class cannot be loaded.
In line 55 of WebimpressCodingStandard/Sniffs/NamingConventions/ExceptionSniff.php
we just call class_exists
and per documentation it should not throw exception - just return bool value: https://www.php.net/manual/en/function.class-exists.php
I would revisit your autoloaders to check what is the real source of your issue. Thanks
I've created a simple project that reproduces the issue: https://github.com/stefanfisk/webimpress-coding-standard-issue-128.
It uses standard Composer 2.0 autoloading, and I tested it with PHP 7.4.12.
@stefanfisk thanks, I'll have look into it
@stefanfisk thanks a lot for the example, I've found a fix - just created PR #133 and will release it with 1.1.7 :) Thanks again!
It looks like it can't be fixed any easy way on PHP < 7.3... So I think I will move it to 1.2.0 release...
@michalbundyra thanks for the fix, and for a great coding standard!
An example of when this happens is if a class that extends a non-existing class, like this file:
Which produces the following output when run with
-vvv
and onlyWebimpressCodingStandard.NamingConventions.Exception
: