coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

`SlevomatCodingStandard.Classes.RequireAbstractOrFinal` should exclude classes with `@final` annotation

Open asispts opened this issue 1 year ago • 0 comments

I often exclude src/Entity from this sniff due to Doctrine entities being non-final classes. However, adding @final annotation to these classes and including checkTooWideReturnTypesInProtectedAndPublicMethods in PHPStan config allows us to detect mismatched return types in the class.

It would be beneficial to modify this sniff to enforce classes to either have abstract or final keywords or be annotated with @final.

asispts avatar Mar 18 '24 15:03 asispts