David Négrier, CTO of the CodingMachine, wrote a nice article on why he likes and how his team uses typehints.
As a developer consuming this
function, I know how to use it. And if I’m using it wrong, I’ll know right away because PHP will crash with a nice error message when the function is called rather than with a cryptic error some time later.
Personally I like typehints too, because the potential readability improvement the article touches upon.
Note: (I only include this paragraph because it’s mentioned in the intro of the article, don’t want to stir up a discussion) the fuzz about that “Visual Debt” video was overblown. Even though I didn’t agree with all of it, it was nice to hear Jeffrey’s way of thinking.