Re: Re: [RFC] "arrayable" pseudo type hint

From: Date: Tue, 04 Feb 2020 18:40:01 +0000
Subject: Re: Re: [RFC] "arrayable" pseudo type hint
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-108400@lists.php.net to get a copy of this message
Am 04.02.20 um 19:17 schrieb Rowan Tommins: > I think Larry's point was that the flexibility of PHP's array type makes it > really hard to pin down whether a given object is "array-like" or not, and > which attributes a particular function actually cares about. What else besides array access, counting and traversing is possible that may differ from classes that implement those interfaces? > A general "intersection type" system might be more useful, because then you > could require the parts you specifically needed, such as > "traversable&ArrayAccess" or "traversable&countable". I think that's too complicated and we should make it as easy as possible for PHP developers. Also, there's already an RFC for intersection types but it was never adopted: https://wiki.php.net/rfc/intersection_types

« previous php.internals (#108400) next »