Re: Make Closure covariant to callable
| From: | Gina P. Banyard | Date: | Tue, 12 Nov 2024 23:22:31 +0000 |
| Subject: | Re: Make Closure covariant to callable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125948@lists.php.net to get a copy of this message | ||
On Tuesday, 12 November 2024 at 16:43, Claude Pache <claude.pache@gmail.com> wrote:
> But personally, I would be more interested in having a type equivalent to
>
callable&object, that is all objects that implement the
> __invoke() magic method (this is a strict super-type of \Closure).
>
> —Claude
An Invokable interface, similar to Stringable would be the solution to this..
And this is something that Ondřej also brought up in the PR.
I would be in favour for such an interface (considering the cat is already out of the bag of
auto-implementing things with Stringable).
But I don't think I have the time/bandwidth to work on this, so if anyone wants something
"easy" to work on that would be it.
Best regards,
Gina P. Banyard