Re: [PHP-DEV] RFC: Trait expects interface

2022-01-18 Thread Jordan LeDoux
On Tue, Jan 18, 2022 at 1:07 PM Rowan Tommins wrote: > > 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-

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-18 Thread Rowan Tommins
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 "sel

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-18 Thread Jordan LeDoux
On Tue, Jan 18, 2022 at 11:13 AM Rowan Tommins wrote: > > The difference with the "trait requires interface" proposal is that I > don't understand what advantage it gives the author of the trait. What > decisions can you make as a library developer because you've said "users > of this trait must

Re: [PHP-DEV] RFC: Trait expects interface

2022-01-18 Thread Rowan Tommins
On 17/01/2022 18:03, Mike Schinkel wrote: "...I must implement an abstract method" "...I must implement all the methods in an interface" "...I must pass all arguments declared in a function" "...I must pass arguments that are of the type that were type-hinted" In all of the