facebook pixelCodiga Analysis PHP Rules
BACK TO LIST

PHP rules

Codiga provides multiple sets of rules for 12+ languages. Below we provide a link and a description for all the rules supported by our platform. Note that not all the rules are being listed and described below.

BooleanArgumentFlag

Code style
Critical

Check method that have a boolean argument, it's often a bad design decision

Learn more

BooleanGetMethodName

Design
Informational

getter methods which returns a boolean should be named 'is...()' or 'has...()'

ConstantNamingConventions

Code style
Informational

Constants should be defined in uppercase

ConstructorWithNameAsEnclosingClass

Code style
Informational

Classes should not have a constructor method with the same name as the class

CouplingBetweenObjects

Design
Error

Check that classes do not have higher coupling

CyclomaticComplexity

Best practice
Warning

Check cyclomatic complexity

DepthOfInheritance

Design
Informational

Ensure that class hirearchy is not too large

DevelopmentCodeFragment

Design
Error

Do not call print\_r in production call

ElseExpression

Code style
Critical

Check for code simplification and not use else when not necessary

EvalExpression

Design
Informational

Check for eval expression.

ExcessiveClassComplexity

Best practice
Warning

Check class complexity

ExcessiveClassLength

Best practice
Warning

Check class maximum number of lines

ExcessiveMethodLength

Best practice
Warning

Check max number of lines of functions (100 by default)

ExcessiveParameterList

Best practice
Warning

Functions should not have more than 10 parameters

ExcessivePublicCount

Best practice
Warning

Classes should not have more than 55 attributes and functions

ExitExpression

Design
Critical

Check exit expression in functions

GotoStatement

Design
Informational

Do not use goto

LongVariable

Design
Warning

Avoid long variables names (more than 20 characters)

NPathComplexity

Best practice
Warning

Check function complexity

NumberOfChildren

Design
Error

Ensure class has less than 15 children

ShortMethodName

Design
Warning

Avoid short methods names (more than 3 characters)

ShortVariable

Design
Warning

Avoid short variables names (more than 3 charactrs)

TooManyFields

Best practice
Warning

Keep the number of fields for classes under 15.

TooManyMethods

Best practice
Warning

Class has too many getters

TooManyPublicMethods

Best practice
Warning

Keep number of public methods in classes under 10.

UnusedLocalVariable

Error prone
Warning

Avoid unused local variables

UnusedPrivateField

Error prone
Warning

Avoid unused private fields

UnusedPrivateMethod

Error prone
Warning

Avoid unused private methods

CountInLoopExpression

Design
Error

Avoid count()/sizeof() in the a loop

DuplicatedArrayKey

Best practice
Error

Duplicate array key

ErrorControlOperator

Best practice
Warning

Remove error control operator.

LongClassName

Code style
Informational

Long class name

ShortClassName

Design
Warning

Avoid short class names.

UndefinedVariable

Best practice
Warning

Avoid using undefined variables, it will lead to PHP notices.