In config/app.php
'aliases' => [
'Route' => Illuminate\Support\Facades\Route::class,
],
when I am using Route
in routes/web.php
like
Route::get('/', 'UserController@home');
I installed php intelephense extension in my vs code. So that it is showing error like
Does anyone have any idea how to fix this issue? (Functionality is working fine but it is showing like the error is the problem)
Aliases are registered at runtime so they are not in the namespace and Intelephense cannot pick them up.
See the question asked on the Intelephense project in Github https://github.com/bmewburn/vscode-intelephense/issues/1116
"These classes don't exist in the workspace. Laravel creates them at runtime. As such they are reported as undefined. The solution is to either provide stub definitions https://github.com/barryvdh/laravel-ide-helper or turn off the diagnostics (intelephense.diagnostics.undefinedTypes)."