Re: Make Closure covariant to callable

From: Date: Wed, 13 Nov 2024 14:57:02 +0000
Subject: Re: Make Closure covariant to callable
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-125951@lists.php.net to get a copy of this message
On Wednesday, 13 November 2024 at 00:46, Levi Morrison <levi.morrison@datadoghq.com> wrote: > 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. Best regards, Gina P. Banyard

« previous php.internals (#125951) next »