For PHP, these tools are:
- PHP Mess Detector (PHPMD)
- PHP Code Sniffer (PHPCS)
- PHP Code Sniffer Fixer (PHPCBF)
- PHPSTAN
- PSALM
- PHP Mess Detector (PHPMD)
PHPMD makes sure that your code follows the SOLID principles, adheres to the software design patterns, follows the naming conventions, and checks for unused code. This is all done by the list of rules the PHPMD has and those rules are grouped into 6 rulesets:
You can find more about each of these groups and the rules that they have by visiting their respective documentation. Below you’ll find my most used configuration for this tool with 2 examples of how to override rules, specifically for naming to ignore the $id
property of a class or database model or i
,j
loop variables and how to ignore a static call for a class if there is no other way how to call that class.