How to Improve Code Quality With PHPStan

And Discover bugs in your code without running it!

Data 4 Everyone!
CodeX

--

The PHP ecosystem is incredible because of the quality of the tools you have available to monitor and improve the quality of your PHP applications.

If you haven’t already read it, an excellent introduction to this article would be my feedback on the 3500 code reviews I did during my previous life as an open-source contributor.

If there is only one idea that should motivate you to improve your practices, you should automate everything that can be automated.

What Is PHPStan and How does it work?

We have many static analysis tools in the PHP ecosystem; PHPStan is the most successful and popular.

This software developed in PHP scans your code and applies several rules.

Photo by Alexander Sinn on Unsplash

These rules are associated with “levels” of quality. To date, there are ten levels of quality from zero to nine (we could say “difficulty” at this stage 😉 ), and the more you go up a level, the more the number of rules to respect increases!

If you want to try the tool on an example project, you can download this one prepared for the occasion.

Install and set up PHPStan

--

--