Re: Make Closure covariant to callable

From: Date: Fri, 15 Nov 2024 17:35:54 +0000
Subject: Re: Make Closure covariant to callable
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> > There are some weird cases with callable which is why they aren't
> > allowed as a property type. I don't remember all the edges, but if we
> > are sure that we cannot hit those with simple co-/contra-variance,
> > then I don't think this needs an RFC and we can just merge the PR.
>
> The reason that callable is not allowed as a property type is due to scope/method visibility
> issues.
> See the discussion section of Nikita's Deprecate partially supported callables RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables#discussion
> The callable type is allowed as a parameter and return type, and Closure is "better"
> defined than just callable.

Then personally I see no reason to make this an RFC and would
recommend merging it in as a gap in existing features (not really a
new feature).


Thread (9 messages)

« previous php.internals (#125964) next »