Unfortunately there’s not a lot of documentation on getting Yii2 and PHPStan to work together.
I’ve integrated proget-hq/phpstan-yii2, I’ve followed the documentation to the best of my ability, I’ve tinkered and googled to no avail.
Running the analysis fills up the console with errors “Access to static property $app on an unknown class Yii.” and “Call to static method t() on an unknown class Yii.”, so symbol discovery is obviously not working.
In phpstan.neon I have the following:
includes:
- vendor/proget-hq/phpstan-yii2/extension.neon
parameters:
level: 1
paths:
- backend/controllers
- backend/helpers
- backend/models
- backend/tests/unit
- backend/widgets
- common/models
- common/helpers
- common/interfaces
- common/modules
- common/rules
- common/tests/unit
- common/widgets
- console/controllers
- console/helpers
- console/models
yii2:
config_path: %rootDir%/../../../common/config/boostrap.php
I’ve tried various combination for config_path.
Could somebody please fill me in on what the config file should look like?