My Laravel code works fine but the PHP Intelephense extension shows unnecessary error in the code. If I delete the extension, the error goes away and reappears when I reinstall it. It also shows some errors in the Laravel helpers.php folder too. My tutor uses PHPStorm and he calls the request() directly doesn’t get any errors. I mean I use VSCode and the request() works without any error but I just want to fix the squiggly error. Can anyone help me fix this issue?
I tried uninstalling and tried again but the error doesn’t go away. Also tried configuring the settings.json file with help of chatGPT but didn’t work out either. 🙁
2
Answers
In order for VS code to find the
request
function, it relies on the vendor/laravel/framework/composer.json file. Specificially the definition inside this block referring to the Foundation/helpers.php file.Make sure this definition exists. if not, you can always add it to your own composer.json file.
The problem here is the
docblock
in therequest()
. Almost all helpers have this problem. I think it is because of these change [11.x] feat: add more specific types and tests for helpersEdit #1
If it really bothers you you can put a
null
value inside therequest()