arkitect
arkitect copied to clipboard
new Implement(\Throwable:;class) doesn't work as expected and has false positives
Bug Report
Q | A |
---|---|
BC Break | yes? |
Library Version | 0.3.25 |
PHP version | 8.2 |
Summary
I try to check if all my exceptions are suffixed by Exception keyword
Current behavior
All interfaces and traits seems to be flagged as violation
How to reproduce
Create this rule:
$rules[] = Rule::allClasses()
->that(new Implement(\Throwable::class))
// also doesn't work with ->that(new Implement('Throwable'))
// also doesn't work with ->that(new Extend(\Exception::class))
->should(new HaveNameMatching('*Exception'))
->because('reasons');
Expected behavior
- The exceptions not suffixing Exception should be flagged as violations (that's not the case)
- All interfaces and traits should not be flagged as violations (because they don't event extend Throwable in my case)