---
title: "format/control-flow"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

if, switch, match, loops, return and the other control structures. Also in [lint](/docs/rules/lint/control-flow) (16) and [analyse](/docs/rules/analyse/control-flow) (8).

**[braces](/docs/rules/format/control-flow/braces)**

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

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

**[continuation-position](/docs/rules/format/control-flow/continuation-position)**

Control structure continuation keyword must be on the configured line.

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

**[elseif](/docs/rules/format/control-flow/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](/docs/rules/format/control-flow/empty-loop-body)**

Empty loop-body must be in configured style.

Not in any preset. Safe fix.

**[empty-loop-condition](/docs/rules/format/control-flow/empty-loop-condition)**

Empty loop-condition must be in configured style.

Not in any preset. Safe fix.

**[include](/docs/rules/format/control-flow/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](/docs/rules/format/control-flow/no-alternative-syntax)**

Replace control structure alternative syntax to use braces.

In the `format-laravel` preset. Safe fix.

**[no-break-comment](/docs/rules/format/control-flow/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](/docs/rules/format/control-flow/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](/docs/rules/format/control-flow/no-unneeded-parentheses)**

Removes unneeded parentheses around control statements.

In the `format-laravel` preset. Safe fix.

**[switch-case-colon](/docs/rules/format/control-flow/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](/docs/rules/format/control-flow/switch-case-space)**

Removes extra spaces between colon and case value.

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

**[yoda](/docs/rules/format/control-flow/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.
