Extended mess detection rules from phpmd for SilverStripe applications. The rules make it easier for developers to comply with the SilverStripe Coding Conventions. It uses mostly standard PHPMD rules, with a few notable changes:
- Replaced
UnusedPrivateField
withUnusedInstancePrivateField
rule, to check to instance fields only. Unused private statics are by design in SilverStripe. - Replaced
CamelCasePropertyName
withCamelCaseInstancePropertyName
rule. Static properties in SilverStripe are snake cased. - Removed inflexible checks around camelCase naming conventions
Global installation for usage across projects:
composer global require --prefer-dist chillu/phpmd-silverstripe
Local installation on an existing project:
composer require chillu/phpmd-silverstripe
For global installations:
~/.composer/vendor/bin/phpmd <my-project> text ~/.composer/vendor/chillu/phpmd-silverstripe/Rulesets/all.xml
For local installations:
vendor/bin/phpmd <my-project> text vendor/chillu/phpmd-silverstripe/Rulesets/all.xml
For more details, refer to the command line usage guides on phpmd.org.