---
title: "analyse/control-flow/non-boolean-ternary"
pagination: false
---

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

<RuleId id="analyse/control-flow/non-boolean-ternary" />

In the [`analyse-strict`](/docs/rules/presets/analyse-strict) preset and every stricter one. Report only. Upstream gates: `strictRules.booleansInConditions`.

## Configuration

```toml title="pun.toml"
[analyse.rules]
"control-flow/non-boolean-ternary" = "on"
```

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

## Replaces

- [`BooleanInTernaryOperatorRule`](https://github.com/phpstan/phpstan-strict-rules#readme) (phpstan-classes)
- [`ternary.condNotBoolean`](https://phpstan.org/error-identifiers/ternary.condNotBoolean) (phpstan-strict-rules)

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