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

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

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

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

## What it does

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

## Configuration

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

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

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `namespaces` | `bool` | Any | `false` | `namespaces` |

## Replaces

- [`no_unneeded_braces`](https://cs.symfony.com/doc/rules/control_structure/no_unneeded_braces.html) (php-cs-fixer)
- [`ReplaceBlockToItsStmts`](https://getrector.com/rule-detail/replace-block-to-its-stmts-rector) (rector)
- [`no-redundant-block`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-redundant-block) (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)
