---
title: "analyse/disallowed/namespace"
pagination: false
---

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

<RuleId id="analyse/disallowed/namespace" />

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

## What it does

Reports uses of the namespaces and classes the config forbids (`disallowedNamespaces`, `disallowedClasses`).

## Configuration

```toml title="pun.toml"
[analyse.rules]
"disallowed/namespace" = "on"
```

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

## Replaces

- [`NamespaceFirstClassCallableUsages`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`NamespaceUsages`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-classes)
- [`disallowed.class`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.enum`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.interface`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.namespace`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)
- [`disallowed.trait`](https://github.com/spaze/phpstan-disallowed-calls/blob/v4.15.1/docs/custom-rules.md) (phpstan-disallowed-calls)

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