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

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

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

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

## Configuration

```toml title="pun.toml"
[analyse.rules]
"undefined/trait" = "on"
```

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

## Replaces

- [`ExistingClassInTraitUseRule`](https://phpstan.org/error-identifiers/class.nameCase) (phpstan-classes)
- [`NonExistentClassLike`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`interface.traitUse`](https://phpstan.org/error-identifiers/interface.traitUse) (phpstan)
- [`trait.notFound`](https://phpstan.org/error-identifiers/trait.notFound) (phpstan)
- [`traitUse.class`](https://phpstan.org/error-identifiers/traitUse.class) (phpstan)
- [`traitUse.enum`](https://phpstan.org/error-identifiers/traitUse.enum) (phpstan)
- [`traitUse.interface`](https://phpstan.org/error-identifiers/traitUse.interface) (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)
