DEV Community

Discussion on: PHP Array: A Gross Mistake

Collapse
 
xedinunknown profile image
Anton Ukhanev

Heya, @suckup_de! Could you expand on that a little? I'm not saying anywhere that I don't use collections, but also I am not sure exactly how you mean their usage here. You can specify the type for the index and the value, yes. But I am once again unsure how this relates to what I write here.

Collapse
 
suckup_de profile image
Lars Moelleken

Heyho, if you want to be sure the "thing" needs to be of a certain type, use typed collections.

They mostly already have or you can simply add e.g. the Iterator interface, and voila. 🙂 No need for falsy phpdocs in the application logic anymore.

Collapse
 
xedinunknown profile image
Anton Ukhanev

Oh, yea, totally. But I thought that you are either agreeing or disagreeing with what I wrote here, while it seems that you are adding a point about collections.

Some comments have been hidden by the post's author - find out more