Re: Allow Iterator to be used with current, next, reset, key functions
| From: | Levi Morrison | Date: | Fri, 04 Nov 2016 15:10:58 +0000 |
| Subject: | Re: Allow Iterator to be used with current, next, reset, key functions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96732@lists.php.net to get a copy of this message | ||
On Thu, Nov 3, 2016 at 8:52 PM, David Lundgren <dlundgren@syberisle.net> wrote:
> On 11/3/16 2:58 PM, Levi Morrison wrote:
>>> I think it would be bad to remove these functions and force users to
>>> wrap arrays with ArrayIterator, just to manually iterate an array. After
>>> spending a little time looking through how these functions are being
>>> used in frameworks and libraries, removing them seems like it will cause
>>> more harm than good, even in a future version of the language.
>>
>> Can you show some examples of frameworks and libraries you found where
>> it would cause more harm than good?
>
> Apologies, that was a subjective statement. I also made it appear that
> the usage of these functions was greater than it may really be, and
> would cripple said projects, that was not my intention, and most
> definitely not the case.
>
> These are the ones I remember, and another way could be used if
> current/next/key were not available for these contexts:
>
> Yii CMarkdownParser: https://git.io/vXCiy
> ZF2 stdlib FastPriorityQueue: https://git.io/vXCiH
> Drupal DI Container: https://git.io/vXCPB
> Symfony MO file loader: https://git.io/vXCPK
> Symfony HttpFoundation Request: https://git.io/vXCXW
>
>
> Dave
> --
> David Lundgren
> dlundgren@syberisle.net
> GPG: 0x26F54D7F
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
Many of these just seem to use
current to get the first item and
would easily migrate to a new API such as first().