Home > Software engineering >  Set multiple bootsrap files with PHPStan
Set multiple bootsrap files with PHPStan

Time:10-20

I have this structure :

apps
 - project_1
   - app
   - vendor
 - project_2
   - app
   - vendor
 - project_3
   - app
   - vendor
phpstan.neon
composer.json

I can’t run PHPStan at the root of "apps" to analyze my projects 1, 2 3 etc ... I have class errors not found.

So i made this structure on my phpstan.neon

parameters:
    level: 1
    paths:
        - apps/project_1/app
        - apps/project_1/config
        - apps/project_1/lambda
        - apps/project_1/tests
    bootstrapFiles:
        - apps/project_1/vendor/autoload.php

It's working but i can't add multiple bootstrapFiles for my differents projects.

This, it's not working:

parameters:
    level: 1
    paths:
        - apps/project_1/app
        - apps/project_1/config
        - apps/project_1/lambda
        - apps/project_1/tests
        - apps/project_2/app
    bootstrapFiles:
        - apps/project_1/vendor/autoload.php
        - apps/project_2/vendor/autoload.php

I need something like this:

parameters:
    level: 1
    paths:
        - apps/project_1/app
        - apps/project_1/config
        - apps/project_1/lambda
        - apps/project_1/tests
    bootstrapFiles:
        - apps/project_1/vendor/autoload.php
    paths:
        - apps/project_2/app
    bootstrapFiles:     
        - apps/project_2/vendor/autoload.php

It's possible to specify bootstrapFiles for specifcs paths please ?

Thank's you :) !

CodePudding user response:

The preferred approach is to have separate phpstan.neon for each projects so that they can be analysed completely separately.

To analyse them all at once create for example a Makefile script that lets you run PHPStan separately on all of those at once.

  • Related