Accessing last_login_at on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a
concrete implementation of the interface.
Accessing last_login_ip on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a
concrete implementation of the interface.
The method logout does only exist in Illuminate\Contracts\Auth\StatefulGuard, but not in Illuminate\Contracts\Auth\Guard.
It seems like the method you are trying to call exists only in some of the
possible types.
Let’s take a look at an example:
classA{publicfunctionfoo(){}}classBextendsA{publicfunctionbar(){}}/** * @param A|B $x */functionsomeFunction($x){$x->foo();// This call is fine as the method exists in A and B.$x->bar();// This method only exists in B and might cause an error.}
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.