PrivateInFinalClassRule
fails with traits containing an abstract
protected
method implemented in a final
class
#838
Labels
Description
The
PrivateInFinalClassRule
in PHPStan is currently failing under the following scenario:When a trait declares an abstract protected method and a final class uses this trait and implements the abstract method, PHPStan issues an error due to the implemented method being
protected
instead ofprivate
. However, I believe that the implemented abstract method should retain the same access modifier, which isprotected
.Steps to Reproduce
Create a trait with an abstract protected method:
Create a final class that uses the trait and implements the abstract method with a protected access modifier:
Run PHPStan analysis on the above code
Expected Behavior
PHPStan should not issue an error when a final class implements an abstract protected method from a trait.
The text was updated successfully, but these errors were encountered: