Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

lint/complexity

Code that can be written more simply, and size and complexity limits.

no-and-assignment

Split 2 assigns with “and” to separate lines

In the code-quality set. Safe fix.

no-boolean-flag-parameter

Flags function-like parameters that use a boolean type and drive the function’s behaviour.

Not in any set. Report only.

no-compact

Change compact() call to own array

In the code-quality set. Safe fix.

no-concat-assign-new-item

Change concat assign on a new array item to plain assign, as the new item is always null

In the code-quality set. Safe fix.

no-constant-condition

Detects if statements where the condition is a constant that always

In the dead-code set. Safe fix.

no-constant-via-variable

Change variable class constant fetch to direct class constant fetch when class or constant target is final

In the code-quality set. Safe fix.

no-dirname-dir-concat

Change dirname() and string concat, to DIR and direct string path

In the code-quality set. Safe fix.

no-duplicate-match-arm

Detects match arms that produce the same result as an earlier arm.

In the code-quality set. Report only.

no-else-clause

Flags if statements that include an else or elseif branch.

Not in any set. Report only.

no-empty-file

Detects redundant files that contain no executable code or declarations.

Not in any set. Report only.

no-excessive-cyclomatic

Checks the cyclomatic complexity of classes, traits, enums, interfaces, functions, and closures.

Not in any set. Report only.

no-excessive-enum-cases

Detects enums with too many cases.

Not in any set. Report only.

no-excessive-halstead

Computes Halstead metrics (volume, difficulty, effort) and reports if they exceed configured thresholds.

Not in any set. Report only.

no-excessive-kan-defect

Detects classes, traits, interfaces, functions, and closures with high kan defect.

Not in any set. Report only.

no-excessive-methods

Detects class-like structures with too many methods.

Not in any set. Report only.

no-excessive-nesting

Checks if the nesting level in any block exceeds a configurable threshold.

Not in any set. Report only.

no-excessive-parameters

Detects functions, closures, and methods with too many parameters.

Not in any set. Report only.

no-excessive-properties

Detects class-like structures with too many properties.

Not in any set. Report only.

no-goto

Detects the use of goto statements and labels.

Not in any set. Report only.

no-iterator-to-array-in-foreach

Detects iterator_to_array() calls used directly as a foreach expression.

In the code-quality set. Report only.

no-negated-boolean-literal

Replace negated boolean literals (!false, !true) with their simplified equivalents (true, false)

In the code-quality set. Safe fix.

no-negated-group

Simplify negated conditions with de Morgan theorem

In the code-quality set. Safe fix.

no-negated-instanceof-ternary

Flip negated ternary of instanceof to direct use of object

In the code-quality set. Safe fix.

no-phpdoc-class-case-mismatch

Fix a misspelled class name casing in a @var docblock to match the real class name

In the code-quality set. Safe fix.

no-redundant-isset

Detects redundant arguments in isset() calls where a nested access already implies the parent checks.

In the code-quality set. Safe fix.

no-redundant-literal-return

Detects redundant literal guard patterns where an if statement checks if a variable equals a literal and returns that same literal, followed by returning the variable.

In the code-quality set. Safe fix.

no-redundant-null-check

Return the value directly instead of checking it for null first.

In the code-quality set. Safe fix.

no-redundant-nullsafe

Flags the use of the nullsafe operator (?->) in contexts where its null-checking behavior is redundant.

In the code-quality set. Safe fix.

no-redundant-write-visibility

Detects redundant write visibility modifiers on properties.

In the code-quality set. Report only.

no-single-case-switch

Change switch with only 1 check to if

In the code-quality set. Safe fix.

no-single-item-in-array

Changes in_array() with single element to ===

In the code-quality set. Safe fix.

no-sole-value-sprintf

Remove sprintf() wrapper if not needed

In the code-quality set. Safe fix.

no-unused-label

Detects redundant goto labels that are declared but not used.

In the code-quality set. Report only. Upstream gates: bleedingEdge (featureToggles.unusedLabel).

no-useless-array-values

Removes unneeded array_values() in in_array() call

In the code-quality set. Safe fix.

prefer-absolute-include

Migrate include/require to absolute path. This Rector might introduce backwards incompatible code, when the include/require being changed depends on the current working directory.

In the code-quality set. Safe fix.

prefer-array-literal

Change array_merge of non arrays to array directly

In the code-quality set. Safe fix.

prefer-coalesce-over-empty-ternary

Change ternary empty on array property with array dim fetch to coalesce operator

In the code-quality set. Safe fix.

prefer-empty-array-compare

Compare with [] instead of empty()/is_array() on arrays.

In the code-quality set. Safe fix.

prefer-explicit-array-comparison

Make array if conditions more explicit

In the code-quality set. Safe fix.

prefer-func-num-args

Simplify count of func_get_args() to func_num_args()

In the code-quality set. Safe fix.

prefer-if-statement

Change inline if to explicit if

In the code-quality set. Safe fix.

prefer-in-array

Use in_array() instead of repeated ||/&& comparisons, array_search() checks and foreach loops.

In the code-quality set. Safe fix.

prefer-inline-array-return

Inline just in time array dim fetch assigns to direct return

In the code-quality set. Safe fix.

prefer-instance-method

Change static method and local-only calls to non-static

In the code-quality set. Safe fix.

prefer-min-max

Change ternary number compare to max() call

In the code-quality set. Safe fix.

prefer-named-literal-argument

Name literal arguments (true, false, null, numbers) in calls.

Not in any set. Report only.

prefer-not-in-array

Use ! in_array() instead of repeated !==/!= comparisons of one value joined by &&.

In the code-quality set. Safe fix.

prefer-null-coalesce

Use ?? instead of isset()/array_key_exists() ternaries, if/return chains and foreach lookups.

In the code-quality set. Safe fix. Gated by php-version.

prefer-property-default

Move property default from constructor to property default

In the code-quality set. Safe fix.

prefer-property-exists

Use property_exists() instead of array_key_exists() or isset() on object properties.

In the code-quality set. Safe fix. Gated by php-version.

prefer-simple-condition

Simplify a negated comparison or a comparison with a boolean

In the code-quality and dead-code sets. Safe fix.

require-attribute-argument-order

Sort named arguments in PHP 8 attributes to match their declaration order

In the code-quality set. Safe fix.

require-consistent-return

Add explicit return null to method/function that returns a value, but missed main return

In the code-quality set. Safe fix.

require-is-a-allow-string

Complete missing 3rd argument in case is_a() function in case of strings

In the code-quality set. Safe fix.

require-named-argument-order

Order named arguments as the parameters are declared.

In the code-quality set. Safe fix.

require-previous-exception

When throwing into a catch block, checks that the previous exception is passed to the new throw clause

In the code-quality set. Safe fix.

Last updated on

Was this page helpful?