[Rule] Validate that a class contains only methods from interface #10524
Replies: 1 comment 1 reply
-
This a great use-case for you to write a custom rule. Unfortunately it's too opinionated to be included in PHPStan's core. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PHP natively validates whether a class implements all methods from interface. What if this could be reversed, i.e. a class should have only methods that are required by the interface(s)?
This could be configurable to exclude given methods like static methods (e.g. named constructor use case)
Beta Was this translation helpful? Give feedback.
All reactions