lint/style
One consistent way to write the same thing.
add-param-type-from-phpdoc
Takes @param annotations of non-mixed types and adjusts accordingly the function signature.
Not in any set. Unsafe fix: it can change behaviour.
add-property-type-from-phpdoc
Takes @var annotation of non-mixed types and adjusts accordingly the property signature..
Not in any set. Unsafe fix: it can change behaviour.
add-return-type-from-phpdoc
Takes @return annotation of non-mixed types and adjusts accordingly the function signature.
Not in any set. Unsafe fix: it can change behaviour.
no-alias-function
Master functions shall be used instead of aliases.
In the coding-style set. Unsafe fix: it can change behaviour.
no-ambiguous-constant
Enforces that all constant references made from within a namespace are explicit.
Not in any set. Report only.
no-ambiguous-function
Enforces that all function calls made from within a namespace are explicit.
Not in any set. Report only.
no-array-accumulation-in-loop
Detects O(n²) array accumulation patterns inside loops.
In the coding-style set. Report only.
no-array-push
Converts simple usages of array_push($x, $y); to $x[] = $y;.
In the code-quality set. Unsafe fix: it can change behaviour.
no-assign-in-ternary-branch
Assign outcome of ternary condition to variable, where applicable
In the code-quality set. Safe fix.
no-call-user-func
Call callables directly instead of through call_user_func().
In the code-quality and coding-style sets. Unsafe fix: it can change behaviour.
no-dynamic-method-call
Disallows calling a method by a variable name ($object->$method()).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-dynamic-method-callable
Disallows a first-class callable of a method with a variable name ($object->$method(...)).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-dynamic-property
Disallows accessing a property by a variable name ($object->$property).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-dynamic-static-call
Disallows calling a static method by a variable name (Foo::$method()).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-dynamic-static-callable
Disallows a first-class callable of a static method with a variable name (Foo::$method(...)).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-dynamic-static-property
Disallows accessing a static property by a variable name (Foo::$$property).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
no-empty
Detects the use of the empty() construct.
In the code-quality set. Unsafe fix: it can change behaviour. Intent: suspicious. Upstream gates: strictRules.disallowedEmpty.
no-ereg
Replace deprecated ereg regular expression functions with preg.
In the modernize set. Unsafe fix: it can change behaviour.
no-escaped-quotes
Prefer quote that are not inside the string
In the coding-style set. Safe fix.
no-hash-emoji
Discourages usage of the #️⃣ emoji in place of the ASCII #.
In the coding-style set. Safe fix.
no-ini-set
Enforces that ini_set is not used.
Not in any set. Report only.
no-inline-html
Disallows inline content (text outside of PHP tags) in source files.
Not in any set. Report only.
no-invalid-phpdoc
Checks for syntax errors in docblock comments, such as malformed {@see} or
In the coding-style set. Report only.
no-is-null
Replaces is_null($var) expression with null === $var.
Not in any set. Unsafe fix: it can change behaviour.
no-isset
Detects the use of the isset() construct.
Not in any set. Report only.
no-multi-assign
Split chained assignments ($a = $b = 1) into one assignment per statement.
In the coding-style set. Safe fix.
no-multiple-classes-per-file
Ensures that each file contains at most one class-like definition (class, interface, enum, or trait).
Not in any set. Report only.
no-nested-ternary
Nested ternary expressions are disallowed to improve code clarity and prevent potential bugs arising from confusion over operator associativity.
In the coding-style set. Report only.
no-parameter-shadowing
Detects when a function or method parameter is shadowed by a loop variable,
In the coding-style set. Report only.
no-php4-constructor
Convert PHP4-style constructors to __construct.
In the modernize set. Unsafe fix: it can change behaviour.
no-redundant-final
Removes final from methods where possible.
In the modernize set. Unsafe fix: it can change behaviour.
no-redundant-final-const
Remove final from constants in classes defined as final
In the dead-code set. Safe fix.
no-redundant-yield-from
Yield from array must be unpacked to series of yields.
In the coding-style set. Unsafe fix: it can change behaviour.
no-short-ternary
Detects the use of the shorthand ternary and elvis operators.
In the coding-style set. Report only. Upstream gates: strictRules.disallowedShortTernary.
no-side-effects-with-declarations
Enforces that a PHP file either declares symbols (classes, functions,
Not in any set. Report only.
no-sleep-wakeup
Replace __sleep()/__wakeup() with __serialize()/__unserialize().
In the modernize set. Unsafe fix: it can change behaviour. Gated by php-version.
no-sprintf-concat
Disallows string concatenation with the result of an sprintf call.
Not in any set. Report only.
no-unreachable-loop
Detects loops (for, foreach, while, do-while) that unconditionally break or return
In the coding-style set. Report only.
no-useless-printf
There must be no printf calls with only the first argument.
In the coding-style set. Unsafe fix: it can change behaviour.
no-useless-sprintf
Remove sprintf() calls with only the format argument.
In the dead-code set. Unsafe fix: it can change behaviour.
no-variable-variable
Disallows variable variables ($$name).
In the coding-style set. Report only. Upstream gates: strictRules.noVariableVariables.
prefer-arrow-function
Anonymous functions with return as the only statement must use arrow functions.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-cast-over-intval
Replaces intval, floatval, doubleval, strval and boolval function calls with according type casting operator.
Not in any set. Unsafe fix: it can change behaviour.
prefer-cast-over-settype
Cast shall be used, not settype.
In the code-quality set. Unsafe fix: it can change behaviour.
prefer-catch-name-from-type
Type and name of catch exception should match
In the coding-style set. Safe fix.
prefer-class-constant
Use Foo::class instead of class-name strings.
In the modernize and coding-style sets. Unsafe fix: it can change behaviour.
prefer-class-keyword-on-object
Replace get_class calls on object variables with class keyword syntax.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-compound-assignment
Shorthand notation for operators should be used if possible.
In the code-quality set. Unsafe fix: it can change behaviour.
prefer-create-from-timestamp
Suggests DateTimeImmutable::createFromTimestamp() when a Unix timestamp is converted
Not in any set. Report only.
prefer-date-time-immutable
Class DateTimeImmutable should be used instead of DateTime.
Not in any set. Unsafe fix: it can change behaviour. Intent: suspicious.
prefer-dir-constant
Replaces dirname(__FILE__) expression with equivalent __DIR__ constant.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-dirname-levels
Replace nested dirname() calls with one call and a $levels argument.
In the modernize set. Unsafe fix: it can change behaviour. Gated by php-version.
prefer-early-continue
Continue early instead of nesting the loop body in an if.
In the early-return set. Safe fix.
prefer-early-return
Return early instead of nesting the rest of the function in an if or else.
In the code-quality set. Safe fix.
prefer-early-return-over-prepared-value
Return early from each if instead of preparing a variable that is returned at the end.
In the code-quality set. Safe fix.
prefer-empty-string-compare
Compare with '' instead of strlen() === 0.
In the code-quality set. Unsafe fix: it can change behaviour.
prefer-generic-array-phpdoc
PHPDoc array<T> type must be used instead of T[].
Not in any set. Unsafe fix: it can change behaviour.
prefer-instanceof-stringable
Detects the legacy pattern is_object($x) && method_exists($x, '__toString') and suggests
In the coding-style set. Report only.
prefer-list-phpdoc
PHPDoc list type must be used instead of array without a key.
Not in any set. Unsafe fix: it can change behaviour.
prefer-php-version-id
Changes use of call to version compare function to use of PHP version constant
In the coding-style set. Safe fix.
prefer-phpdoc-comment
Comments with annotation should be docblock when used on structural elements.
Not in any set. Unsafe fix: it can change behaviour.
prefer-pow-operator
Converts pow to the ** operator.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-property-over-local-getter
Privatize getter of local property to property
In the privatization set. Unsafe fix: it can change behaviour.
prefer-random-int
Replaces rand, srand, getrandmax functions calls with their mt_* analogs or random_int.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-readonly-keyword
Converts readonly comment on classes to the readonly keyword.
In the coding-style set. Unsafe fix: it can change behaviour.
prefer-self-reference
Inside class or interface element self should be preferred to the class name itself.
Not in any set. Unsafe fix: it can change behaviour.
prefer-short-ternary
Use the Elvis operator ?: where possible.
Not in any set. Unsafe fix: it can change behaviour.
prefer-spread
Replace call_user_func_array() with variadic
In the coding-style set. Safe fix.
prefer-static-private-method
Converts private methods to static where possible.
Not in any set. Unsafe fix: it can change behaviour.
prefer-str-contains
Replace strpos() and stripos() calls with str_starts_with() or str_contains() if possible.
In the modernize set. Unsafe fix: it can change behaviour.
prefer-variadic-param
Refactor func_get_args() in to a variadic param
In the coding-style set. Safe fix.
prefer-while-loop
Suggests using a while loop instead of a for loop when the for loop does not have any
Not in any set. Report only.
require-assign-set-padding
Add extra space before new assign set
In the coding-style set. Safe fix.
require-create-from-format-bang
The first argument of DateTime::createFromFormat method must start with !.
Not in any set. Unsafe fix: it can change behaviour.
require-final-class
All classes must be final, except abstract ones and Doctrine entities.
Not in any set. Unsafe fix: it can change behaviour.
require-final-internal-class
Internal classes should be final.
Not in any set. Unsafe fix: it can change behaviour.
require-final-public-method
All public methods of abstract classes should be final.
Not in any set. Unsafe fix: it can change behaviour.
require-fopen-binary-flag
The flags in fopen calls must omit t, and b must be omitted or included consistently.
Not in any set. Unsafe fix: it can change behaviour.
require-fopen-flag-order
Order the flags in fopen calls, b and t must be last.
Not in any set. Unsafe fix: it can change behaviour.
require-implode-separator
Function implode must be called with 2 arguments in the documented order.
In the modernize set. Unsafe fix: it can change behaviour.
require-namespace
Detects files that contain definitions (classes, interfaces, enums, traits, functions, or constants)
Not in any set. Report only.
require-naming-convention
Enforce naming conventions for classes, interfaces, traits, enums, functions, methods, properties, constants and variables (options per kind).
Not in any set. Report only.
require-ordered-traits
Trait use statements must be sorted alphabetically.
Not in any set. Unsafe fix: it can change behaviour.
require-parent-visibility
Make method visibility same as parent one
In the coding-style set. Safe fix.
require-phpdoc
Detects declarations that are missing a docblock.
Not in any set. Report only.
require-sorted-integer-keys
Detects array literals with integer keys that are not in ascending order.
Not in any set. Report only.
require-statement-padding
Add empty new line after different-type statements to improve code readability
In the coding-style set. Safe fix.
require-todo-reference
Require TODO and FIXME comments to reference a user or issue.
Not in any set. Report only.