Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: merge usage & migration from single baseline #28

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -35,18 +35,24 @@ composer require --dev shipmonk/phpstan-baseline-per-identifier
> [!IMPORTANT]
> _This usage is available since version 2.0. See legacy usage below if you are still using PHPStan 1.x_
Setup baselines loader, other files will be placed beside that file:
```neon
# phpstan.neon.dist
includes:
- baselines/loader.neon # instead of traditional phpstan-baseline.neon
Remove old single baseline include:
```diff
-includes:
- - phpstan-baseline.neon
```

Run native baseline generation and split it into multiple files via our script:
Run native baseline generation and split it into multiple files via our script (other baseline files will be placed beside the loader):
```sh
vendor/bin/phpstan --generate-baseline=baselines/loader.neon && vendor/bin/split-phpstan-baseline baselines/loader.neon
```

Setup the baselines loader:
```neon
# phpstan.neon.dist
includes:
- baselines/loader.neon
```

_(optional)_ You can simplify generation with e.g. composer script:
```json
{
@@ -99,10 +105,3 @@ Prepare composer script to simplify generation:
## PHP Baseline
- If the loader file extension is php, the generated files will be php files as well

## Migrating from single baseline

1. `rm phpstan-baseline.neon` (and remove its include from `phpstan.neon.dist`)
2. `mkdir baselines`
3. `touch baselines/loader.neon` (and include it in `phpstan.neon.dist`)
4. Run the split script from above