---
title: "lint/dead-code/no-duplicate-array-key"
pagination: false
---

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

<RuleId id="lint/dead-code/no-duplicate-array-key" />

In the [`dead-code`](/docs/rules/sets/dead-code) set. Safe fix.

## What it does

Remove duplicated key in defined arrays

## Configuration

```toml title="pun.toml"
[lint.rules]
"dead-code/no-duplicate-array-key" = "error"
```

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

## Replaces

- [`RemoveDuplicatedArrayKey`](https://getrector.com/rule-detail/remove-duplicated-array-key-rector) (rector)
- [`DuplicateKeysInLiteralArraysRule`](https://phpstan.org/error-identifiers/array.duplicateKey) (phpstan-classes)
- [`DuplicateArrayKey`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`array.duplicateKey`](https://phpstan.org/error-identifiers/array.duplicateKey) (phpstan)

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