Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Typehint all the things

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.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.