12

In VSCode the PHP intelephense extension version 1.3.7 marks the laravel Facades as classes not found. Before if you import a Facade like this:

use Log;

and then use it in the file like this:

Log::info('some message');

which is correct there were no issues. Now every usage is marked as a syntax error and you have to import the fully qualified name like the following for the error to go away.

use \Illuminate\Support\Facades\Log;

Also it didn't used to complain about the Eloquent class's methods like find or where etc but now it underlines them as methods not defined.

Is there a way for the extension to ignore these?

Mubashar Abbas
  • 5,536
  • 4
  • 38
  • 49
  • 1
    I know it's a little late. But I'm struggling with this, too. Maybe you are looking for something like this: https://stackoverflow.com/a/59266972/9994944 (Setting some of the Intelephense PHP options to false in settings.json) – jamawe Dec 17 '20 at 09:03

2 Answers2

1

You can try barryvdh/laravel-ide-helper.

it makes VScode to refer Facade files.

example)

    "require-dev": {
        ...
        "barryvdh/laravel-ide-helper": "^2.7",
        ...
    },
byzz
  • 364
  • 1
  • 4
  • 17
0

A solution which is really a life saver here is the php namespace resolver extension, it gives you all the possible options that you want as a dropdown menu.

Here is the link

Here I don't have a the required category controller in my api.php routes, what I just need to do is go to my route where my controller is defined

Right click on my class which I want to add and click import

If there are multiple options, VS Code will show me a drop down from command palette to, I just have to select the right one and simply add it

runtimeTerror
  • 398
  • 3
  • 14