---
title: "analyse/arrays/invalid-array-key"
pagination: false
---

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

<RuleId id="analyse/arrays/invalid-array-key" />

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

## Configuration

```toml title="pun.toml"
[analyse.rules]
"arrays/invalid-array-key" = "on"
```

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

## Replaces

- [`InvalidKeyInArrayItemRule`](https://phpstan.org/error-identifiers/array.invalidKey) (phpstan-classes)
- [`InvalidArrayElementKey`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`array.invalidKey`](https://phpstan.org/error-identifiers/array.invalidKey) (phpstan)

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