PHPStan finds bugs in your code without writing tests. See: PHPStan
You will need to install it into the project vendors to run in CI jobs:
$ composer require --dev phpstan/phpstan phpstan/phpstan-doctrine phpstan/phpstan-phpunit phpstan/phpstan-symfonyInclude the config file into the root of your project for PHPStan to use.
For those who want additional safety in extremely defensive programming, You will need to install next:
$ composer require --dev phpstan/phpstan-webmozart-assert phpstan/phpstan-strict-rulesAdd rules to your *.neon config file:
includes:
# ...
# Additions
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
- vendor/phpstan/phpstan-strict-rules/rules.neonThe path will be
[path to composer root]/vendor/bin/phpstanIn inspection settings, select checkbox, choose level and custom ruleset pointing to our setting file.
$ vendor/bin/phpstan analyse -c phpstan.neonWhen adding PHPStan to a huge project you may start at level 1 to avoid having to fix a lot of things all at once. As you fix the issues, gradually increase the level to a maximum.
All new projects should be set at highest level from the start.

