使用 PHPStan 设置多个引导文件
Set multiple bootsrap files with PHPStan
我有这个结构:
apps
- project_1
- app
- vendor
- project_2
- app
- vendor
- project_3
- app
- vendor
phpstan.neon
composer.json
我无法 运行 PHPStan 在“应用程序”的根目录下分析我的项目 1、2、3 等...我有 class 未找到的错误。
所以我在 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
它工作正常,但我无法为我的不同项目添加多个 bootstrapFiles。
这个,没用:
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
我需要这样的东西:
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
可以为特定路径指定 bootstrapFiles 吗?
谢谢你 :) !
首选方法是为每个项目单独 phpstan.neon
,以便可以完全独立地对其进行分析。
要同时分析它们,例如创建一个 Makefile
脚本,让您可以 运行 PHPStan 一次单独分析所有这些。
我有这个结构:
apps
- project_1
- app
- vendor
- project_2
- app
- vendor
- project_3
- app
- vendor
phpstan.neon
composer.json
我无法 运行 PHPStan 在“应用程序”的根目录下分析我的项目 1、2、3 等...我有 class 未找到的错误。
所以我在 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
它工作正常,但我无法为我的不同项目添加多个 bootstrapFiles。
这个,没用:
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
我需要这样的东西:
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
可以为特定路径指定 bootstrapFiles 吗?
谢谢你 :) !
首选方法是为每个项目单独 phpstan.neon
,以便可以完全独立地对其进行分析。
要同时分析它们,例如创建一个 Makefile
脚本,让您可以 运行 PHPStan 一次单独分析所有这些。