[RFC] Traits with interfaces
| From: | Kevin Gessner | Date: | Wed, 17 Feb 2016 14:25:50 +0000 |
| Subject: | [RFC] Traits with interfaces | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-91245@lists.php.net to get a copy of this message | ||
Hello internals team! I'd like to propose an RFC to allow traits to
implement interfaces.
I've noticed s pattern in Etsy's code and elsewhere, where a trait provides
a common implementation of an interface. Classes that use the trait are
required to also explicitly declare the interface to benefit. I propose
that traits be permitted to declare and implement interfaces. Classes that
use such a trait would then implement the interface, as though it were
declared on the class, without declaring the interface explicitly.
I believe this small change would be a useful improvement to the OO
system. I've written a draft RFC, but I don't have karma to create the
wiki page for it. Could someone please grant wiki karma to my account,
kevingessner?
I don't yet have an implementation, but I'll be starting on one once I've
posted the RFC. I look forward to your thoughts and feedback.
Thanks in advance
-- Kevin
Kevin Gessner
Staff Software Engineer
etsy.com