---
title: "analyse/classes/incompatible-constant-override"
pagination: false
---

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

<RuleId id="analyse/classes/incompatible-constant-override" />

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

## What it does

Reports overrides of final constants, reduced constant visibility, and incompatible native or PHPDoc constant types. Native and PHPDoc covariance checks run with the essential preset and stricter presets.

## Configuration

```toml title="pun.toml"
[analyse.rules]
"classes/incompatible-constant-override" = "on"
```

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

## Replaces

- [`OverridingConstantRule`](https://phpstan.org/error-identifiers/classConstant.final) (phpstan-classes)
- [`OverrideFinalConstant`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`classConstant.final`](https://phpstan.org/error-identifiers/classConstant.final) (phpstan)
- [`classConstant.missingNativeType`](https://phpstan.org/error-identifiers/classConstant.missingNativeType) (phpstan)
- [`classConstant.nativeType`](https://phpstan.org/error-identifiers/classConstant.nativeType) (phpstan)
- [`classConstant.type`](https://phpstan.org/error-identifiers/classConstant.type) (phpstan)
- [`classConstant.visibility`](https://phpstan.org/error-identifiers/classConstant.visibility) (phpstan)

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