Rule Description KPI URL
BooleanArgumentFlag A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method. Maintainability https://phpmd.org/rules/cleancode.html
ElseExpression An if expression with an else branch is never necessary. You can rewrite the conditions in a way that the else is not necessary and the code becomes simpler to read. To achieve this use early return statements. To achieve this you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations. Maintainability https://phpmd.org/rules/cleancode.html
StaticAccess Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods Maintainability https://phpmd.org/rules/cleancode.html
ExcessiveParameterList Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. Understandability https://phpmd.org/rules/codesize.html
ExcessivePublicCount A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. Understandability https://phpmd.org/rules/codesize.html
TooManyFields Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field. Understandability https://phpmd.org/rules/codesize.html
TooManyMethods A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. By default it ignores methods starting with ‘get’ or ‘set’. The default was changed from 10 to 25 in PHPMD 2.3. Understandability https://phpmd.org/rules/codesize.html
TooManyPublicMethods A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. By default it ignores methods starting with ‘get’ or ‘set’. Understandability https://phpmd.org/rules/codesize.html
Superglobals Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance Maintainability https://phpmd.org/rules/controversial.html
CamelCaseClassName It is considered best practice to use the CamelCase notation to name classes. Maintainability https://phpmd.org/rules/controversial.html
CamelCasePropertyName It is considered best practice to use the camelCase notation to name attributes. Maintainability https://phpmd.org/rules/controversial.html
CamelCaseMethodName It is considered best practice to use the camelCase notation to name methods. Maintainability https://phpmd.org/rules/controversial.html
CamelCaseParameterName It is considered best practice to use the camelCase notation to name parameters Maintainability https://phpmd.org/rules/controversial.html
CamelCaseVariableName It is considered best practice to use the camelCase notation to name variables. Maintainability https://phpmd.org/rules/controversial.html
ShortVariable Detects when a field, local, or parameter has a very short name. Understandability https://phpmd.org/rules/naming.html
LongVariable Detects when a field, formal or local variable is declared with a long name. Understandability https://phpmd.org/rules/naming.html
ShortMethodName Detects when very short method names are used. Understandability https://phpmd.org/rules/naming.html
ConstructorWithNameAsEnclosingClass A constructor method should not have the same name as the enclosing class, consider to use the PHP 5 __construct method. Understandability https://phpmd.org/rules/naming.html
ConstantNamingConventions Class/Interface constant names should always be defined in uppercase. Understandability https://phpmd.org/rules/naming.html
BooleanGetMethodName Looks for methods named ‘getX()’ with ‘boolean’ as the return type. The convention is to name these methods ‘isX()’ or ‘hasX()’. Understandability https://phpmd.org/rules/naming.html