Skip to content

Auth::user return type porblem with Intelephense #1116

Answered by kenjis
hfdzz asked this question in Q&A
Discussion options

You must be logged in to vote

I got your situation.
Intelephense is no problem. Because Auth::user() return type is User not your extended UserEntity.
User does not have the myUserMethod() method.

  1. Extend the Auth class and change the return type, and use it in your app.
  2. Specify the return value type of Auth::user() manually.
/** @var UserEntity $user */
$user = Auth::user();

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@hfdzz
Comment options

@kenjis
Comment options

Answer selected by datamweb
@sanchawebo
Comment options

@hfdzz
Comment options

@kenjis
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants