Re: RFC: Trait expects interface

From: Date: Tue, 18 Jan 2022 21:07:43 +0000
Subject: Re: RFC: Trait expects interface
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-116895@lists.php.net to get a copy of this message
On 18/01/2022 20:55, Jordan LeDoux wrote:
In this situation, the return value of the trait requires that $this implements the NumberInterface, however there is no way for the trait itself to enforce this.
Fair enough, that's a reasonable use case, thank you. I could quibble and say that "self" or "static" would probably work in that particular example, but I suspect that would just lead to an unproductive spiral of example and counter-example. I'm not yet convinced that this use case is frequent enough to pass the high bar of adding a new language feature, but it at least reassures me that this isn't just control for control's sake. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#116895) next »