Thanks for that comment! I’ve been using PhpStorm for so long now I’ve forgotten what all I actually installed to get where I am :-D
I wasn’t going to nitpick an otherwise great article, but this is nonsense. Those problems would have been unaffected by an upgrade; I suspect he “spent months” simply refactoring some poorly written code to something better.
There is no coupling issue involved in what you are describing.
In this particular example, you’re right. Mapping is much more open and generic — you could do all sorts of work on the record before mapping to a new collection. With pluck you are only taking the two values.
The real thing to notice here is that you can create your keys — in fact, the original name was “mapToAssoc()”
Very well written. Thank you, as well, for saving my Sunday afternoon for something other than writing my own rebuttal. The more I read “PHP The Wrong Way”, the more I found myself shaking my head in disagreement.
I think his article was (generally) well-intended but could have been written as “Don’t make mindless decisions”.
Exactly! For example, take cars — ever since they made the new, completely computer-run engines that I no longer understand how to fix, I have been rendered incapable of knowing whether or not we should allow drunk driving & text driving, or if speed limits are even necessary anymore.
You are repeated the “new argument” that seems to be going around, and it is a ridiculous one.