Re: Making stdClass iterable

From: Date: Mon, 14 Jan 2019 13:18:49 +0000
Subject: Re: Making stdClass iterable
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-103728@lists.php.net to get a copy of this message
On Mon, 14 Jan 2019 at 11:57, Nikita Popov <nikita.ppv@gmail.com> wrote: > Rather than implementing Traversable, I think it would be much better to > implement IteratorAggregate and provide a proper getIterator() > implementation. Objects that only implement Traversable are a PITA to work > with and lots of code assumes that anything Traversable will either be > Iterator or IteratorAggregate. For userland code this is strictly enforced, > but internal code can avoid this. However, the current exceptions to this > are rather niche, while stdClass is somewhat commonly used. > That makes sense, if the RFC passes I'll pick up these implementation points before proceeding, thanks

« previous php.internals (#103728) next »