> 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
> > really hard to pin down whether a given object is "array-like" or not,
> > 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
> > 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
FWIW, that's an old RFC that predates the current implementation of union
types in PHP 8 by a few years... A new proposal for intersection types
should stand a better chance now, especially as it can mostly reuse the
(relatively involved) technical underpinnings for the union types