shipmonk/phpstan-baseline-per-identifier

Split your PHPStan baseline into multiple files, one per error identifier. Supports both neon baseline and PHP baseline.

Package info

github.com/shipmonk-rnd/phpstan-baseline-per-identifier

Type:phpstan-extension

pkg:composer/shipmonk/phpstan-baseline-per-identifier

Statistics

Installs: 1 634 074

Dependents: 20

Suggesters: 0

Stars: 93

Open Issues: 1

2.3.0 2025-12-08 10:45 UTC

MIT b997803a60f1f604b9fe0aed5d6d1edead010190

devPHPStanphpstan baselinephpstan extensionerror identifier


README

Split your PHPStan baseline into multiple files, one per error identifier:

baselines/
 ├─ _loader.neon
 ├─ empty.notAllowed.neon
 ├─ foreach.nonIterable.neon
 ├─ identical.alwaysFalse.neon
 └─ if.condNotBoolean.neon

Each file looks like this:

# total 1 error

parameters:
 ignoreErrors:
 -
 message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
 path: ../app/index.php
 count: 1

Installation:

composer require --dev shipmonk/phpstan-baseline-per-identifier

Usage

Important

This usage is available since version 2.0. See legacy usage below if you are still using PHPStan 1.x

Remove old single baseline include:

-includes:
-	- phpstan-baseline.neon

Run native baseline generation and split it into multiple files via our script (other baseline files will be placed beside the loader):

vendor/bin/phpstan --generate-baseline=baselines/_loader.neon && vendor/bin/split-phpstan-baseline baselines/_loader.neon

Setup the baselines loader:

# phpstan.neon.dist
includes:
 - baselines/_loader.neon

(optional) You can simplify generation with e.g. composer script:

{
 "scripts": {
 "generate:baseline:phpstan": [
 "phpstan --generate-baseline=baselines/_loader.neon",
 "split-phpstan-baseline baselines/_loader.neon"
 ]
 }
}

Cli options

The vendor/bin/split-phpstan-baseline script accepts the following options:

  • --tabs to use tabs as indents in generated neon files
  • --no-error-count to remove errors count in generated files

PHP Baseline

  • If the loader file extension is php, the generated files will be php files as well