Re: Consolidation of Traversable and array operations

From: Date: Wed, 15 Jul 2015 19:53:23 +0000
Subject: Re: Consolidation of Traversable and array operations
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-87189@lists.php.net to get a copy of this message
On 15 July 2015 20:39:05 GMT+01:00, Levi Morrison <levim@php.net> wrote: >Do note that the union types RFC would also alleviate some of this >pain for user-land functions, since array | Traversable would >cover >the required access pattern. I think this is a superior approach >myself, but I may be a bit biased as I am authoring that proposal: >https://wiki.php.net/rfc/union_types I like the idea of union types in general, but have always felt that a typehint of Traversable should accept arrays as a matter of course. The only thing such a typehint guarantees is that foreach will work (there are no methods defined that can be called directly), and an array meets that condition. The only difference I can see is in the passing / mutability behaviour of objects vs non-objects. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#87189) next »