---
title: "analyse/classes/duplicate-declaration"
pagination: false
---

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

<RuleId id="analyse/classes/duplicate-declaration" />

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

## Configuration

```toml title="pun.toml"
[analyse.rules]
"classes/duplicate-declaration" = "on"
```

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

## Replaces

- [`DuplicateDeclarationRule`](https://phpstan.org/error-identifiers/class.duplicateConstant) (phpstan-classes)
- [`DuplicateDefinition`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`class.duplicate`](https://phpstan.org/error-identifiers/class.duplicate) (phpstan)
- [`class.duplicateConstant`](https://phpstan.org/error-identifiers/class.duplicateConstant) (phpstan)
- [`class.duplicateEnumCase`](https://phpstan.org/error-identifiers/class.duplicateEnumCase) (phpstan)
- [`class.duplicateMethod`](https://phpstan.org/error-identifiers/class.duplicateMethod) (phpstan)
- [`class.duplicateProperty`](https://phpstan.org/error-identifiers/class.duplicateProperty) (phpstan)
- [`enum.duplicate`](https://phpstan.org/error-identifiers/enum.duplicate) (phpstan)
- [`enum.duplicateConstant`](https://phpstan.org/error-identifiers/enum.duplicateConstant) (phpstan)
- [`enum.duplicateEnumCase`](https://phpstan.org/error-identifiers/enum.duplicateEnumCase) (phpstan)
- [`enum.duplicateMethod`](https://phpstan.org/error-identifiers/enum.duplicateMethod) (phpstan)
- [`enum.duplicateProperty`](https://phpstan.org/error-identifiers/enum.duplicateProperty) (phpstan)
- [`function.duplicate`](https://phpstan.org/error-identifiers/function.duplicate) (phpstan)
- [`interface.duplicate`](https://phpstan.org/error-identifiers/interface.duplicate) (phpstan)
- [`interface.duplicateConstant`](https://phpstan.org/error-identifiers/interface.duplicateConstant) (phpstan)
- [`interface.duplicateEnumCase`](https://phpstan.org/error-identifiers/interface.duplicateEnumCase) (phpstan)
- [`interface.duplicateMethod`](https://phpstan.org/error-identifiers/interface.duplicateMethod) (phpstan)
- [`interface.duplicateProperty`](https://phpstan.org/error-identifiers/interface.duplicateProperty) (phpstan)
- [`trait.duplicate`](https://phpstan.org/error-identifiers/trait.duplicate) (phpstan)
- [`trait.duplicateConstant`](https://phpstan.org/error-identifiers/trait.duplicateConstant) (phpstan)
- [`trait.duplicateEnumCase`](https://phpstan.org/error-identifiers/trait.duplicateEnumCase) (phpstan)
- [`trait.duplicateMethod`](https://phpstan.org/error-identifiers/trait.duplicateMethod) (phpstan)
- [`trait.duplicateProperty`](https://phpstan.org/error-identifiers/trait.duplicateProperty) (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)
