You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traits cannot be made `final`, but the methods therein _can_.
There is a caveat though: the class `use`-ing the trait can still overload the method. Also see: https://externals.io/message/120576
In other words: the `final` keyword, in this case, only protects against _child_ classes of the class `use`-ing the trait overloading the method. And as most sniff are now `final` by design, this could be seen as a redundant change.
Having said that, I still think it has value to add the keyword, if only to signal that these method shouldn't be overloaded.
Includes adding a sniff to the WPCS native PHPCS ruleset to enforce this.
0 commit comments