---
title: "analyse/control-flow/switch-type-mismatch"
pagination: false
---

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

<RuleId id="analyse/control-flow/switch-type-mismatch" />

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

## Configuration

```toml title="pun.toml"
[analyse.rules]
"control-flow/switch-type-mismatch" = "on"
```

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

## Replaces

- [`MatchingTypeInSwitchCaseConditionRule`](https://github.com/phpstan/phpstan-strict-rules#readme) (phpstan-classes)
- [`switch.type`](https://phpstan.org/error-identifiers/switch.type) (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)
