---
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. That covers includes that an included `.php` file builds with variables, `foreach`, `if`, `glob()`, `is_file()`, `class_exists()`, and `interface_exists()`. `class_exists()` and `interface_exists()` know only PHP's and PHPStan's own classes. Any other class, such as one from a PHPStan extension in `vendor/`, stops the migration with an error.

| phpstan.neon | pun.toml |
| --- | --- |
| `level: 5` | `[analyse] preset = "phpstan/level_5"`, which runs exactly PHPStan's level 5 |
| `level: 0..10`, `level: max` | `preset = "phpstan/level_<n>"` or `"phpstan/level_max"`, with on/off lines only for what the config changes, such as opt-in checks or strict-rules. `--offer-preset` offers Pun's closest preset instead |
| `paths`, `excludePaths`, `stubFiles` | `[analyse] paths`, `exclude`, `stubs` |
| `scanFiles`, `scanDirectories`, `bootstrapFiles` | `[analyse] scan` and `bootstrap`. Files under `vendor/` come back with their extension and aren't copied |
| `ignoreErrors` identifiers, patterns, paths, count, `reportUnmatched` | `[[analyse.ignore]]` with Pun `rule`, original `identifier`, `message`, `paths`, `count`, `report-unmatched` |
| `reportUnmatchedIgnoredErrors: false` | `[analyse] report-unmatched = false`, and `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 |
| nesbot/carbon's `extension.neon` | Built in: `carbon = "on"` in `[extensions]` when composer.lock locks `nesbot/carbon` |
| 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, because the lint rule sees no types and can miss some |
| `@phpstan-ignore method.notFound` | `@pun-ignore analyse/undefined/method` |
| Baselines | Not copied. Run `pun analyse --generate-baseline`. |
| `bleedingEdge.neon` include | `[analyse] bleeding-edge = true`, and an `"on"` line for each rule it turns on |
| `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)
