It seems like $authService of type object<Longman\Platfourm...s\Auth\AuthUserService> is incompatible with the declared type object<Longman\Platfourm\Auth\Middleware\Guard> of property $authService.
Our type inference engine has found an assignment to a property that is incompatible
with the declared type of that property.
Either this assignment is in error or the assigned type should be added
to the documentation/type hint for that property..
It seems like $url defined by app()->isAdmin() ? admin...n') : site_url('login') on line 59 can also be of type object<Illuminate\Contracts\Routing\UrlGenerator>; however, Illuminate\Routing\Redirector::guest() does only seem to accept string, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.