Re: [VOTE] Interface Default Methods
| From: | Deleu | Date: | Mon, 03 Jul 2023 15:31:44 +0000 |
| Subject: | Re: [VOTE] Interface Default Methods | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120741@lists.php.net to get a copy of this message | ||
>
> Stop using
implements at all and solely rely on
> use.
>
> My 0.02€
>
> Cheers
>
> Andreas
>
A Trait is not part of the Type system, it's not type-hintable, it's not
mockable, it's harder to do code review (a Trait was modified, what gets
impacted?). A trait is just an "easy" way to copy/paste code while hiding
away the code that is being copy/pasted. To be honest here, a Trait is
something that I wouldn't miss if it was deprecated, although I know that's
just wishful thinking. An interface default implementation on the other
hand is extremely powerful and clear. If you're not happy with the default
implementation, just write your own, otherwise less code to write and a
better type system at the end.
--
Marco Deleu