The expression return Modules\User\Entities\User::find($id) could return the type Illuminate\Database\Eloquent\Collection which is incompatible with the type-hinted return Modules\User\Entities\User|null. Consider adding an additional type-check to rule them out.
The expression return Modules\User\Enti...dBy('identity_id', $id) could return the type Eloquent which includes types incompatible with the type-hinted return Modules\User\Entities\User|null. Consider adding an additional type-check to rule them out.