Re: RFC: Trait expects interface

From: Date: Tue, 04 Jan 2022 23:25:53 +0000
Subject: Re: RFC: Trait expects interface
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-116804@lists.php.net to get a copy of this message
On Jan 4, 2022, at 14:35, Kirill Nesmeyanov <nesk@xakep.ru> wrote: > Since «traits» are often an indicator of not very good code and many may not use them quite > correctly, for example, as helpers, I suggest adding support for the > expects keyword to indicate that the trait is part of the code > decomposition taking into account ISP. I like this idea, but I think it'd be even more useful if it could be used with classes as well as interfaces. This would allow traits to reject their use outside an intended class hierarchy. (And, while we're at it: could it be useful for a trait to expect another trait?)

« previous php.internals (#116804) next »