4 ms·
PHPStan is a great tool. In addition to PHPStan, I also use phpnsc (name space checker) to check for missing use statements, php-cs-fixer (code style fixer) to
by phpdave11 7y ago
PHPStan is a great tool. In addition to PHPStan, I also use phpnsc (name space checker) to check for missing use statements, php-cs-fixer (code style fixer) to ensure the code adheres to my code style, phpcpd (copy paste detector) to detect duplicate code, and phpmd (mess detector) to find potential problems in the code. These are all set up in my CI pipeline so that my app will fail to build if any of these 5 tools detect a problem. It has saved me from deploying buggy code several times.
- andreascreten 7y agoMakes sense, thanks for sharing!
- king7532 7y agoGreat advice and thank you for sharing! Do you have a Dockerfile or CI config/recipe that you could share?
- phpdave11 7y agoHere's the bash script I use to do the code validation. It's called from within my Dockerfile. https://gist.github.com/phpdave11/412893f8366cab0afa85e81a7a66bd72#file-validate-code-sh https://gist.github.com/phpdave11/412893f8366cab0afa85e81a7a...
- blowski 7y agoHere’s a GitHub repo and Docker image with lots more static analysis tools to play with: https://github.com/jakzal/phpqa https://github.com/jakzal/phpqa