---
title: "lint/control-flow/prefer-bool-return"
pagination: false
---

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

<RuleId id="lint/control-flow/prefer-bool-return" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix.

## What it does

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

## Configuration

```toml title="pun.toml"
[lint.rules]
"control-flow/prefer-bool-return" = "error"
```

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

## Replaces

- [`simplified_if_return`](https://cs.symfony.com/doc/rules/control_structure/simplified_if_return.html) (php-cs-fixer)
- [`SimplifyIfReturnBool`](https://getrector.com/rule-detail/simplify-if-return-bool-rector) (rector)

## Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See [merged rules](/docs/migrate/merged-rules).

- `lint/control-flow/prefer-returned-condition`

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