Let's be controversial: In modern #PHP, you should never type-hint an array.
Let's be controversial: In modern #PHP, you should never type-hint an array.
@Crell I thought this seemed really familiar, and then I saw the date⦠I probably read this soon after you first posted this also.
Sorry, but then, as now, I'm not really interested in writing my own iterable list thingamabob when the language already gives me one. Plus, when working with someone else's code, if it returns an array, I know what it's doing; if it's some custom ThingamabobIterator I can probably guess but I'm going to have to stop what I'm doing and look up the code to be sure.
@Crell And I wouldn't want to force anyone using my code to learn how to use my own iterators either.
In short, can't we just get a tight little "List" in PHP already and let "arrays" do the dictionary stuff? Yeah, SplBlahBlah but something first class and "native" would be better and more discoverable.