Search code examples
phplaravelphp-intelephense

Expected type 'object'. Found 'array<string, mixed>'. (Intelephense 1006). Can anyone help me please?


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?

Screenshot of my code

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. :(


Solution

  • I came across a PHP Intelephense dev on github, he told me that it was an error in the PHP Intelephense extension and said that they've fixed it in the latest release. After updating the extension, it did fix the issue.

    //But there are few more errors still in the helpers and other folders but he said they'll fix it soon.