SanderRonde / phpstan-vscode

PHPStan plugin for VSCode
https://marketplace.visualstudio.com/items?itemName=SanderRonde.phpstan-vscode
MIT License
37 stars 7 forks source link

"Scan project for errors" not specifying path #36

Closed jrj7 closed 1 year ago

jrj7 commented 1 year ago

When trying to scan the entire project I am getting a At least one path must be specified to analyse error in logs. The only two settings I have altered are defining phpstan.binPath and adding --level max to phpstan.options. Using the scan current file for errors command does work.

Here is the log. I've omitted my paths below:

[server] Language server ready [check:1] Check started for Project [check:1] Spawning PHPStan with the following configuration: {"binCmd":"/path/to/phpstan/","args":["analyse","-c","/path/to/config","--error-format=raw","--no-interaction","--memory-limit=1G","--level max"]} [check:1] PHPStan process exited with error filteredErr=At least one path must be specified to analyse. rawErr=At least one path must be specified to analyse. data= [check:1] Check completed for Project errors= {}

I tried explicitly defining the project directory in phpstan.rootDir and it did not work. What did work is adding a . to phpstan.options but that of course breaks the individual file scanning.

SanderRonde commented 1 year ago

What happens when you run the PHPStan command outside the extension? Do you get the same error?

I'm guessing you didn't put any paths in the parameters.paths section of your phpstan.neon, could that be it?

jrj7 commented 1 year ago

Ah, it was my phpstan.neon. I was unclear as to what the extension handled vs my own config file. Thanks!

Solution: Added path %currentWorkingDirectory% as a parameter in my phpstan.neon file.