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

lint/control-flow

if, switch, match, loops, return and the other control structures. Also in format (13) and analyse (8).

no-assign-in-condition

Detects assignments in conditions which can lead to unexpected behavior and make the code harder

In the code-quality set. Report only. Intent: correctness.

no-else-after-return

Drop the else after a branch that always returns, throws or exits, and move its body after the if.

In the code-quality set. Safe fix.

no-empty-catch

Report an empty catch block, which swallows the exception.

In the code-quality set. Report only. Intent: correctness.

no-for-init-overwrite

Disallows a for loop’s init expression overwriting a variable that is already defined.

In the code-quality set. Report only. Intent: suspicious. Upstream gates: strictRules.overwriteVariablesWithLoop.

no-loop-variable-overwrite

Disallows a foreach key or value variable overwriting a variable that is already defined.

In the code-quality set. Report only. Intent: suspicious. Upstream gates: strictRules.overwriteVariablesWithLoop.

no-return-assignment

Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method.

In the dead-code set. Safe fix.

no-superfluous-elseif

Replaces superfluous elseif with if.

In the dead-code set. Safe fix.

no-switch-continue

Switch case must not be ended with continue but with break.

In the modernize set. Safe fix.

no-unsafe-finally

Detects control flow statements in finally blocks.

In the code-quality set. Report only. Intent: suspicious.

no-useless-else

There should not be useless else cases.

In the early-return set. Safe fix.

no-useless-return

There should not be an empty return statement at the end of a function.

In the dead-code set. Safe fix.

prefer-bare-return

A return statement wishing to return void should not return null.

Not in any set. Safe fix.

prefer-bool-return

Simplify if control structures that return the boolean result of their condition.

In the code-quality set. Safe fix.

prefer-combined-isset

Using isset($var) && multiple times should be done in one call.

In the code-quality set. Safe fix.

prefer-combined-unset

Calling unset on multiple items should be done in one call.

In the code-quality set. Safe fix.

prefer-yield-from

If the function explicitly returns an array, and has the return type iterable, then yield from must be used instead of return.

In the code-quality set. Safe fix.

Last updated on

Was this page helpful?