On Mon, Feb 4, 2019 at 11:58 AM Craig Duncan <p...@duncanc.co.uk> wrote:
>
> Hi all,
>
> Following the discussion it's now time to vote on whether we make the
> stdClass iterable or not.
> https://wiki.php.net/rfc/iterable-stdclass
>
> Note that while there is an implementation available, the vote is only on
> whether stdClass should fulfil the Traversable interface or not.
> Nikita had some ideas on a different implementation that I'll revisit if
> the vote passes.
>
> Voting will end in two weeks on 2019-02-18
>
> Thanks to everybody that shared their opinion and raised concerns during
> the discussion.
>
> Craig

I just wanted to pipe in to suggest an alternative approach to
accomplish some of the same goals: an external PropertyIterator.

  - It could allow us to refine which property visibilities we care to
iterate over. For instance, if we are in a protected or private
context we may want to still only iterate over public properties.
  - I think that with typed properties we will see more data-only
classes which would benefit from an external PropertyIterator.

Of course, that still means `stdClass` isn't automatically `iterable`,
but if you want it to be then you can pass in a PropertyIterator
instead.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to