---
title: "Coming from phpstan"
pagination: false
---

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

## Config translation

`pun migrate` keeps the old config and reports what it skips. Planned rules do not run.

Run `pun migrate --from phpstan`. It follows the config's includes, also the ones an included `.php` file builds with variables, `foreach`, `if`, `glob()`, `is_file()`, `class_exists()` and `interface_exists()`. `class_exists()` and `interface_exists()` know PHP's and PHPStan's own classes only, and stop with an error on any other class, such as one from a PHPStan extension in `vendor/`.

| phpstan.neon | pun.toml |
| --- | --- |
| `level: 5` | `[analyse] preset = "recommended"`, plus explicit on/off lines for exactly level 5 |
| `level: 0..10` | The analyse preset that contains the level, with on/off differences |
| `paths`, `excludePaths`, `stubFiles` | `[analyse] paths`, `exclude`, `stubs` |
| `ignoreErrors` identifiers, patterns, paths, count, `reportUnmatched` | `[[analyse.ignore]]` with Pun `rule`, original `identifier`, `message`, `paths`, `count`, `report-unmatched` |
| `reportUnmatchedIgnoredErrors: false` | `report-unmatched = false` on each entry that doesn't set `reportUnmatched` |
| Changed rule parameters | Kebab-case options on each running rule that reads the parameter |
| strict-rules or deprecation-rules includes | The matching Pun checks, when their parameter enables them |
| A check that is a lint rule in Pun (`array.duplicateKey`) | The lint rule, on in `[[lint.overrides]]` for `paths` and off for `excludePaths`, unless another config turns it on everywhere. `pun analyse` also reports the check's errors under the lint rule's ID, since the lint rule sees no types and can miss them |
| `@phpstan-ignore method.notFound` | `@pun-ignore analyse/undefined/method` |
| Baselines | Not copied. Run `pun analyse --generate-baseline`. |
| `bleedingEdge.neon` include | `[analyse] bleeding-edge = true`; the rules it turns on get `"on"` lines |
| `phpVersion: 80400`, or `{min, max}` | `[php] version = "8.4"`, from `min`; a different `max` is reported and skipped |
| Custom extensions, `rules:` classes, services tagged `phpstan.*` | Reported and skipped, one line each |

The rule mapping lists PHPStan identifiers. An exact identifier wins over a pattern.

## Rule mapping

<MigrationTable tool="phpstan" />

## Unsupported rules

### PHPStan extension-API checks; Pun has no PHP extension API

[`phpParser.classRenamed`](https://phpstan.org/error-identifiers/phpParser.classRenamed), [`phpParser.nodeConnectingAttribute`](https://phpstan.org/error-identifiers/phpParser.nodeConnectingAttribute), [`phpstanApi.class`](https://phpstan.org/error-identifiers/phpstanApi.class), [`phpstanApi.classConstant`](https://phpstan.org/error-identifiers/phpstanApi.classConstant), [`phpstanApi.constructor`](https://phpstan.org/error-identifiers/phpstanApi.constructor), [`phpstanApi.enum`](https://phpstan.org/error-identifiers/phpstanApi.enum), [`phpstanApi.getTemplateType`](https://phpstan.org/error-identifiers/phpstanApi.getTemplateType), [`phpstanApi.instanceofAssumption`](https://phpstan.org/error-identifiers/phpstanApi.instanceofAssumption), [`phpstanApi.instanceofType`](https://phpstan.org/error-identifiers/phpstanApi.instanceofType), [`phpstanApi.interface`](https://phpstan.org/error-identifiers/phpstanApi.interface), [`phpstanApi.method`](https://phpstan.org/error-identifiers/phpstanApi.method), [`phpstanApi.phpstanNamespace`](https://phpstan.org/error-identifiers/phpstanApi.phpstanNamespace), [`phpstanApi.runtimeReflection`](https://phpstan.org/error-identifiers/phpstanApi.runtimeReflection), [`phpstanApi.trait`](https://phpstan.org/error-identifiers/phpstanApi.trait), [`phpstanApi.varTagAssumption`](https://phpstan.org/error-identifiers/phpstanApi.varTagAssumption).

### phpstan.org playground only

[`phpstanPlayground.arrayDimFetchCast`](https://phpstan.org/error-identifiers/phpstanPlayground.arrayDimFetchCast), [`phpstanPlayground.arrayKeyCast`](https://phpstan.org/error-identifiers/phpstanPlayground.arrayKeyCast), [`phpstanPlayground.configParameter`](https://phpstan.org/error-identifiers/phpstanPlayground.configParameter), [`phpstanPlayground.never`](https://phpstan.org/error-identifiers/phpstanPlayground.never), [`phpstanPlayground.noPhp`](https://phpstan.org/error-identifiers/phpstanPlayground.noPhp), [`phpstanPlayground.phpDoc`](https://phpstan.org/error-identifiers/phpstanPlayground.phpDoc), [`phpstanPlayground.traitUnused`](https://phpstan.org/error-identifiers/phpstanPlayground.traitUnused).

## Pun-only rules

- [`lint/comments/no-unused-ignore`](/docs/rules/lint/comments/no-unused-ignore)
