---
title: "analyse/undefined/variable"
pagination: false
---

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

<RuleId id="analyse/undefined/variable" />

In the [`analyse-basic`](/docs/rules/presets/analyse-basic) preset and every stricter one. Report only. **Planned: not in Pun yet.** Enabling it is a config error.

## Replaces

- [`DefinedVariableRule`](https://phpstan.org/error-identifiers/variable.undefined) (phpstan-classes)
- [`checkMaybeUndefinedVariables`](https://phpstan.org/config-reference) (phpstan-parameters)
- [`PossiblyUndefinedVariable`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`ReferenceToUndefinedVariable`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`UndefinedVariable`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`UndefinedVariableInClosureUse`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`variable.nameNotString`](https://phpstan.org/error-identifiers/variable.nameNotString) (phpstan)
- [`variable.undefined`](https://phpstan.org/error-identifiers/variable.undefined) (phpstan)

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