Something that came up in my discussion with Dave Liddament for the Beyond Blocks podcast was that there seem to be two ways of writing PHP code.
One is writing strict code by enabling strict typing, using parameter and return types, and leveraging tools like PHPStan at a high level to analyze code.
The other is no not use types and to use a more "duck typing" approach.
The term "visual debt" came from a video discussing the pros and cons of these approaches.
The same can be said for JavaScript and TypeScript, but PHP can do both and gives the Developer the choice of how they write their code.
I prefer writing strict code and for my code to be as explicit as possible, but I appreciate not everyone does and I like that PHP caters for both.
How do you write your PHP code?
- Oliver
Was this interesting?
About me
I'm an Acquia-certified Drupal Triple Expert with 17
years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.