Re: Make iterator_to_array() accept all iterables

From: Date: Fri, 17 Jun 2022 15:28:02 +0000
Subject: Re: Make iterator_to_array() accept all iterables
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-117980@lists.php.net to get a copy of this message
On Fri, 17 Jun 2022 at 16:20, Tim Düsterhus <tim@bastelstu.be> wrote: > 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 Considering the other RFC has been declined, and I can see the value of it and the change is rather minimal, if no one has any objections I think this is fine to land without any RFC. Best regards, George P. Banyard

« previous php.internals (#117980) next »