---
title: pun migrate
description: Create pun.toml from Pint, PHP CS Fixer, Rector or PHPStan.
---

Create `pun.toml` from your old tool configs. Pun lists every rule it can't move.

## Usage

```bash
pun migrate [options]
```

```bash
pun migrate              # pick configs from a list
pun migrate --from pint  # only Pint
pun migrate --yes        # every config found
pun migrate --dry-run    # show the diff, write nothing
```

## Options

| Option | Description |
| --- | --- |
| `--from <tools>` | Only these tools, comma-separated. |
| `-y`, `--yes` | Every config found, no questions. |
| `--dry-run` | Print a diff and write nothing. |
| `--config <path>` | The `pint.json` to read. Default: `./pint.json`. |
| `--preset <name>` | Use this format preset instead of `pint.json`'s. |
| `--offer-preset` | Offer Pun's closest analyse preset instead of the PHPStan level preset. |

## What happens

- Finds these configs in the project root:

  | Tool | File | Becomes |
  | --- | --- | --- |
  | Pint | `pint.json` | `[format]`, `[lint]`, `[files]` |
  | PHP-CS-Fixer | `.php-cs-fixer.php`, `.php-cs-fixer.dist.php` | `[format]`, `[lint]`, `[files]` |
  | Rector | `rector.php` | `[lint]` |
  | PHPStan | `phpstan.neon`, `phpstan.neon.dist`, `phpstan.dist.neon` | `[analyse]` |

- Moves layout rules to `[format]` and risky fixers to `[lint]`.
- Turns on each extension whose package is in `composer.lock`.
- Rewrites `@php-cs-fixer-ignore` and `@phpstan-ignore` comments to `@pun-ignore`.
- Prints each rule it skipped. Send a PR to add it.
- Leaves your old configs and `composer.json` alone.
- Does not copy PHPStan baselines. Run `pun analyse --generate-baseline` instead.

Reading `.php-cs-fixer.php` or `rector.php` runs project PHP code. Run it only on code you trust, after `composer install`.

Exit code 0 does not mean every rule moved. Read the warnings, then run [`pun check`](/docs/commands/check). Each tool has a [mapping page](/docs/migrate/from).

## Limitations

- `mago.toml` is detected but not converted.
- Pint's `symfony` preset is not supported. Migration stops with an error.
- Custom rules, closures, null configs, and rules Pun doesn't have are skipped with a warning.
- PHPStan custom rules, `phpstan.*` services and your own included configs are skipped. Some PHPStan parameters have no Pun setting. See [`pun analyse`](/docs/commands/analyse#limitations).
- PHPStan baselines are not copied.
- If `pun.toml` already exists and differs, migrate exits 2 and doesn't overwrite it. A `pun.toml` symlink that leads outside the project also stops migrate with exit 2.
- Ignore comments are rewritten only in files inside the project. Symlinked files are skipped.

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | `pun.toml` written. |
| 2 | A config could not be read, `pun.toml` differs from what migrate would write, or another error. |
