---
title: "analyse/disallowed/control-structure"
pagination: false
---

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

<RuleId id="analyse/disallowed/control-structure" />

In the [`analyse-basic`](/docs/rules/presets/analyse-basic) preset and every stricter one. Report only.

## What it does

Reports the control structures the config forbids (`disallowedControlStructures`).

## Configuration

```toml title="pun.toml"
[analyse.rules]
"disallowed/control-structure" = "on"
```

To skip it in some files or lines, add an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`BreakControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ContinueControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`DeclareControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`DoWhileControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ElseControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ElseIfControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ForControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ForeachControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`GotoControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`IfControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`MatchControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`RequireIncludeControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`ReturnControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`SwitchControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`WhileControlStructure`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`disallowed.break`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.continue`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.declare`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.doWhile`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.else`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.elseIf`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.for`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.foreach`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.goto`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.if`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.include`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.includeOnce`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.match`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.require`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.requireOnce`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.return`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.switch`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.while`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)

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