---
title: "analyse/types/throws-not-covariant"
pagination: false
---

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

<RuleId id="analyse/types/throws-not-covariant" />

In the [`analyse-basic`](/docs/rules/presets/analyse-basic) preset and every stricter one. Report only. Upstream gates: `exceptions.check.throwTypeCovariance`.

## Configuration

```toml title="pun.toml"
[analyse.rules]
"types/throws-not-covariant" = "on"
```

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

## Replaces

- [`MethodThrowTypeCovarianceRule`](https://phpstan.org/error-identifiers/throws.notCovariant) (phpstan-classes)
- [`IncompatibleThrowType`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`throws.notCovariant`](https://phpstan.org/error-identifiers/throws.notCovariant) (phpstan)
- [`throws.notCovariantWithImplicitVoid`](https://phpstan.org/error-identifiers/throws.notCovariantWithImplicitVoid) (phpstan)
- [`throws.shouldBeVoid`](https://phpstan.org/error-identifiers/throws.shouldBeVoid) (phpstan)

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