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.neonEach file looks like this:
# total 1 error
parameters:
    ignoreErrors:
        -
            message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
            path: ../app/index.php
            count: 1composer require --dev shipmonk/phpstan-baseline-per-identifierImportant
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.neonRun 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.neonSetup 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",
            "find baselines/ -type f -not -name loader.neon -delete",
            "split-phpstan-baseline baselines/loader.neon"
        ]
    }
}This usage is deprecated since 2.0, but it works in all versions. Downside is that it cannot utilize result cache
Setup where your baseline files should be stored and include its loader:
# phpstan.neon.dist
includes:
    - vendor/shipmonk/phpstan-baseline-per-identifier/extension.neon # or use extension-installer
    - baselines/loader.neon
parameters:
    shipmonkBaselinePerIdentifier:
        directory: %currentWorkingDirectory%/baselines
        indent: '    'Prepare composer script to simplify generation:
{
    "scripts": {
        "generate:baseline:phpstan": [
            "rm baselines/*.neon",
            "touch baselines/loader.neon",
            "phpstan analyse --error-format baselinePerIdentifier"
        ]
    }
}- --tabsto use tabs as indents in generated neon files
- If the loader file extension is php, the generated files will be php files as well