Hi Internals

I've come across a case where it would've been useful if `iterator_to_array()` would accept iterable instead of Traversable to avoid checking whether the input variable already is an array.

To not repeat what I've already written in my proposed PR, please see:

  https://github.com/php/php-src/pull/8819

for more details.

In response to my question whether this would require an RFC or whether this is simple enough, cmb pointed to a previous RFC that proposed *adding* a new function `iterable_to_array()` which was declined:

  https://wiki.php.net/rfc/iterable_to_array-and-iterable_count

cmb also suggested that for this reason this topic should at least be shortly discussed on the list, which I intend to do with this email:

- Do you believe that my PR requires an RFC / do you want to see an RFC for this? - Would you object to extending 'iterator_to_array' from Traversable to iterable (i.e. to Traversable|array)?

Best regards
Tim Düsterhus

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

Reply via email to