Get the latest tech news

Create Weird Fun PHPStan Rules Like Nobody's Watching


There are 2 ways to use PHPStan. You can use native levels, and official extensions and raise the level from 0 to 8. This is a good start, but it often requires enormous work and brings must-have value. There is also a 2nd way: I wanted PHPStan **to be more fun and more tailored to the unique projects I work with**. That's why I made [symplify/phpstan-rules](https://github.com/symplify/phpstan-rules), a package that just crossed 6 200 000 downloads. It is one of the most used PHPStan extensions apart from official ones. I put all the fun and practical rules there, and often they prove to be useful to others too. But today I want you to move from end-user to **creator**.

I've checked other calls in codebase + database and made an astounding discovery: the user id is always an int! Now it's your turn to make however weird, stupid, simple, non-sense PHPStan rule you want. Writing custom PHPStan rules is one of the greatest assets when it comes to raising codebase value in time.

Get the Android app

Or read this on Hacker News