It seems like $created defined by $this->query()->create(a...$role->getGuardName())) on line 18 can also be of type object<Illuminate\Database\Eloquent\Builder>; however, Omatech\Mage\Core\Reposi...tory::syncPermissions() does only seem to accept object<Omatech\Mage\Core\Models\Role>, 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.
$role of type object<Omatech\Mage\Core...ontracts\RoleInterface> is not a sub-type of object<Omatech\Mage\Core\Domains\Roles\Role>. It seems like you assume a concrete implementation of the interface Omatech\Mage\Core\Domain...Contracts\RoleInterface to be always present.
This check looks for parameters that are defined as one type in their type
hint or doc comment but seem to be used as a narrower type, i.e an
implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming
your parameter is of the expected type.
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:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.