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

format/control-flow

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

braces

The body of each control structure MUST be enclosed within braces.

In the format-laravel and format-psr12 presets. Safe fix.

continuation-position

Control structure continuation keyword must be on the configured line.

In the format-laravel and format-psr12 presets. Safe fix.

elseif

The keyword elseif should be used instead of else if so that all control keywords look like single words.

In the format-laravel and format-psr12 presets. Safe fix.

empty-loop-body

Empty loop-body must be in configured style.

Not in any preset. Safe fix.

empty-loop-condition

Empty loop-condition must be in configured style.

Not in any preset. Safe fix.

include

Include/Require and file path should be divided with a single space. File path should not be placed within parentheses.

In the format-laravel preset. Safe fix.

no-alternative-syntax

Replace control structure alternative syntax to use braces.

In the format-laravel preset. Safe fix.

no-break-comment

There must be a comment when fall-through is intentional in a non-empty case body.

In the format-psr12 preset. Safe fix.

no-unneeded-braces

Removes unneeded braces that are superfluous and aren’t part of a control structure’s body.

In the format-laravel preset. Safe fix.

no-unneeded-parentheses

Removes unneeded parentheses around control statements.

In the format-laravel preset. Safe fix.

switch-case-colon

A case should be followed by a colon and not a semicolon.

In the format-laravel and format-psr12 presets. Safe fix.

switch-case-space

Removes extra spaces between colon and case value.

In the format-laravel and format-psr12 presets. Safe fix.

yoda

Write conditions in Yoda style (true), non-Yoda style (['equal' => false, 'identical' => false, 'less_and_greater' => false]) or ignore those conditions (null) based on configuration.

In the format-laravel preset. Safe fix.

Last updated on

Was this page helpful?