For anyone going through these issues and uneasy about disabling a whole set of checks, there is a way to pass your own custom signatures to Intelephense.
Copied from Intelephese repo's comment (by @KapitanOczywisty):
https://github.com/bmewburn/vscode-intelephense/issues/892#issuecomment-565852100
For single workspace it is very simple, you have to create
.php
file with all signatures and intelephense will index them.If you want add stubs globally, you still can, but I'm not sure if it's intended feature. Even if
intelephense.stubs
throws warning about incorrect value you can in fact put there any folder name.{ "intelephense.stubs": [ // ... "/path/to/your/stub" ] }
Note: stubs are refreshed with this setting change.
You can take a look at build-in stubs here: https://github.com/JetBrains/phpstorm-stubs
In my case, I needed dspec's describe
, beforeEach
, it
... to don't be highlighted as errors, so I just included the file with the signatures /directories_and_paths/app/vendor/bin/dspec
in my VSCode's workspace settings, which had the function declarations I needed:
function describe($description = null, \Closure $closure = null) {
}
function it($description, \Closure $closure) {
}
// ... and so on