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

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

<RuleId id="format/control-flow/braces" />

In the [`format-laravel`](/docs/rules/presets/format-laravel) and [`format-psr12`](/docs/rules/presets/format-psr12) presets. Safe fix.

## What it does

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

## Configuration

```toml title="pun.toml"
[format.rules]
"control-flow/braces" = true
```

To skip it in some files, add a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Replaces

- [`control_structure_braces`](https://cs.symfony.com/doc/rules/control_structure/control_structure_braces.html) (php-cs-fixer)
- [`CompleteMissingIfElseBracket`](https://getrector.com/rule-detail/complete-missing-if-else-bracket-rector) (rector)
- [`block-statement`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#block-statement) (mago-linter)

[More format/control-flow rules](/docs/rules/format/control-flow) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
