facebook pixelPHP Static Analysis Rules
BACK TO LIST

PHP rules

Codiga provides multiple set 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
      Minor

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

      ConstantNamingConventions

      Code style
      Minor

      Constants should be defined in uppercase

      ConstructorWithNameAsEnclosingClass

      Code style
      Minor

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

      CouplingBetweenObjects

      Design
      High

      Check that classes do not have higher coupling

      CyclomaticComplexity

      Best practice
      Medium

      Check cyclomatic complexity

      DepthOfInheritance

      Design
      Minor

      Ensure that class hirearchy is not too large

      DevelopmentCodeFragment

      Design
      High

      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
      Minor

      Check for eval expression.

      ExcessiveClassComplexity

      Best practice
      Medium

      Check class complexity

      ExcessiveClassLength

      Best practice
      Medium

      Check class maximum number of lines

      ExcessiveMethodLength

      Best practice
      Medium

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

      ExcessiveParameterList

      Best practice
      Medium

      Functions should not have more than 10 parameters

      ExcessivePublicCount

      Best practice
      Medium

      Classes should not have more than 55 attributes and functions

      ExitExpression

      Design
      Critical

      Check exit expression in functions

      LongVariable

      Design
      Medium

      Avoid long variables names (more than 20 characters)

      NPathComplexity

      Best practice
      Medium

      Check function complexity

      NumberOfChildren

      Design
      High

      Ensure class has less than 15 children

      ShortMethodName

      Design
      Medium

      Avoid short methods names (more than 3 characters)

      ShortVariable

      Design
      Medium

      Avoid short variables names (more than 3 charactrs)

      StaticAccess

      Code style
      Critical

      Avoid static access

      TooManyFields

      Best practice
      Medium

      Keep the number of fields for classes under 15.

      TooManyMethods

      Best practice
      Medium

      Class has too many getters

      TooManyPublicMethods

      Best practice
      Medium

      Keep number of public methods in classes under 10.

      UnusedLocalVariable

      Error prone
      Medium

      Avoid unused local variables

      UnusedPrivateField

      Error prone
      Medium

      Avoid unused private fields

      UnusedPrivateMethod

      Error prone
      Medium

      Avoid unused private methods

      CountInLoopExpression

      Design
      High

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

      DuplicatedArrayKey

      Best practice
      High

      Duplicate array key

      ErrorControlOperator

      Best practice
      Medium

      Remove error control operator.

      LongClassName

      Code style
      Minor

      Long class name

      ShortClassName

      Design
      Medium

      Avoid short class names.

      UndefinedVariable

      Best practice
      Medium

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