On 5/23/2017 9:51 PM, Nikita Popov wrote:
> One of the primary motivations behind this RFC is to allow the addition of
> typehints (for example in library code) without introducing a backwards
> compatibility break for any code implementing or extending your
> interface/class. Requiring an explicit "mixed" or "any" type would not
> allow this. I think this is 95% of the reason for this RFC, so without it,
> the change itself is probably not worthwhile.
> 

Yeah, I remember that and it is actually one of the very first sentences
in the RFC:

> Implementing this RFC would allow libraries to be upgraded to use
> type declarations in their method signatures. Currently adding types
> to a method of a class in a library would break any code that extends
> that class.
>
> --- https://wiki.php.net/rfc/parameter-no-type-variance

This was/is a great feature for library developers. We should probably
add Rasmus' concern to the list of things that can be added in PHP 8.
Another possible approach here could be to enforce an explicit "mixed"
if "strict_types" are active for the declaring class.

-- 
Richard "Fleshgrinder" Fussenegger

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to