Home > Software engineering >  VS Code intelephense shows incorrect error: Undefined method 'save'
VS Code intelephense shows incorrect error: Undefined method 'save'

Time:11-07

I'm using the intelephense v1.8.2 extension in VS Code and I'm working on a laravel project. As I get the user using Auth::user(); and call $user->save(); the intelephonse keep showing incorrect error Undefined method 'save'. Is there a way to fix this issue?

enter image description here

CodePudding user response:

You can use @var to ignore this:

/** @var \App\Models\User $user **/
$user = Auth::user();
$user->name = 'alice';
$user->save();
  • Related