Option to scan only current project on save
I'm working on some projects where inside the main project I also have some packages source code.
These packages have their phpstan.neon referencing some vendor/xxx, but vendor doesn't exist because only the root project has vendor folder.
When I save the extension check all the projects and stops at the first error, so if it first check one of the packages it just stops.
Is it possibile to add an option to just scan current project on save? Or don't stop on first error.
Issues go stale after too much time without activity. If inactive for another 7 days this issue will be closed.
Hey sorry for not responding, I've been a bit busy. That should be possible, will implement it when I find the time.
I looked into it some more. It looks like the extension doesn't actually scan all projects when one changes. On-save it only scans the project that belongs to the saved file. It actually doesn't know about the existence of the other projects in the workspace and only does a lookup on-save. Are you sure this is the current behavior? Is it not PHPStan doing this itself?
I made some better testing.
This is my current folder structure:
project/
├── phpstan.neon
├── app.php
└── libs/
├── mylib1/
| ├── mylib.php
│ └── phpstan.neon
├── mylib2/
│ └── phpstan.neon
This structure is needed so I can edit the libraries while workin on the main project, but the libraries can live on their own, so they have their own phpstan.neon.
On the main phpstan.neon I have libs/ in the path, so they get scanned.
Inside every phpstan.neon there is a includes: vendor/....
Problem:
- When I'm inside
project/app.phpand I save, extension runs phpstan on current project, withproject/phpstan.neon, and everything is good. - When I'm inside
mylib1/mylib.phpand I save, extension runs phpstan withmylib1/phpstan.neon. In this case phpstan looks formylib1/vendor/...and can't find it, crashing and resetting all the other errors. - When I run manually "Scan project for errors" it tries to run all the
phpstan.neonfiles, crashing on the libraries and resetting all the other errors
I don't know what's the best way to make this work. Maybe an option to force a specific phpstan.neon in the workspace?