We use PHP Stan to analyse our code before it hits production.
Below is a quick snippet about how to get it to work.
wget -O /usr/local/bin/phpstan https://github.com/phpstan/phpstan/releases/download/0.12.25/phpstan.phar
chmod +x /usr/local/bin/phpstan
cat > phpstan.neon
parameters:
autoload_files:
- PEAR.php
- DB.php
level: 1
paths:
- ./
excludes_analyse:
- Text/
- PEAR/
- DB/
- MDB2/
phpstan analyze -c phpstan.neon --memory-limit 1G