Re: RFC: Trait expects interface
| From: | Rowan Tommins | Date: | Thu, 06 Jan 2022 23:05:00 +0000 |
| Subject: | Re: RFC: Trait expects interface | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116840@lists.php.net to get a copy of this message | ||
On 6 January 2022 19:51:46 GMT, Robert Korulczyk <robert@korulczyk.pl> wrote:
>You're talking about classes that use traits, but I'm talking about traits themselves.
>If I open a class in editor, there is a straightforward way to
>check if specific method is implementation of an interface - check interfaces implemented by
>class and if one of them have this method, then this
>method is implementation of this interface, and editor can properly mark it and handle
>navigation between implementation in class and declaration in
>interface.
Ah, I see what you're getting at now. I've never particularly had the need to jump between
an interface and a trait, but then I very rarely use traits at all.
In your use cases, are these traits generally *using* the interface methods, or *implementing* them?
For instance, you might have a trait that *requires* the LoggerInterface because it makes use of its
methods, so you want to jump to their documentation when viewing those uses; or you might have a
trait that helps *implement* the LoggerInterface, and you want to link each method to the definition
in the interface that it implements. Is one of these situations more common than the other, in your
experience?
Regards,
--
Rowan Tommins
[IMSoP]