Larastan: Call to an undefined method user()

Created on 19 Jul 2018  路  6Comments  路  Source: nunomaduro/larastan

auth()->user()

No error on

Auth::user()

Call to an undefined method Illuminate\Contracts\Auth\Factory|Illuminate\Contracts\Auth\Guard::user()

I think the code above is also often used in many different projects.

false positive max

Most helpful comment

Seems that a regression happened on v0.3.21 of larastan.
I encounter those 3 errors during a run :

  • Call to an undefined method Illuminate\Contracts\Auth\Factory::check().
  • Call to an undefined method Illuminate\Contracts\Auth\Factory::user().
  • Call to an undefined method Illuminate\Contracts\Auth\Factory::id().

Is anybody else encountering this ?

All 6 comments

Do you mind of doing: composer update nunomaduro/larastan? That problem was already fixed on previous versions.

Please make sure you use the following composer configuration:

        "nunomaduro/larastan": "^0.1",

My composer.json says

"nunomaduro/larastan": "^0.1.0",
````
and my composer.lock
```php
"name": "nunomaduro/larastan",
"version": "v0.1.2",

I also tried your statement, but nothing has been changed.

Have to add id() as well.

auth()->id()

I am running larastan 0.3.12 and get this as well (when using Guard::user())

Same trouble with auth()->check().

Seems that a regression happened on v0.3.21 of larastan.
I encounter those 3 errors during a run :

  • Call to an undefined method Illuminate\Contracts\Auth\Factory::check().
  • Call to an undefined method Illuminate\Contracts\Auth\Factory::user().
  • Call to an undefined method Illuminate\Contracts\Auth\Factory::id().

Is anybody else encountering this ?

Was this page helpful?
0 / 5 - 0 ratings