I am using laravel 11 + phpstan for the quality code.
In this method :
/**
* @param array<string> $request
* @return LengthAwarePaginator<AppModelsUser>
*/
public function index(array $request)
{
$query = User::orderBy('name');
$query->when(isset($request['status']), function ($q) use ($request) {
return $q->where('status', $request['status']);
});
return $query->paginate(10);
}
I have this larastan error :
Method AppRepositoriesUserRepository::index() should return
IlluminatePaginationLengthAwarePaginator<AppRepositoriesAppModelsUser> but returns
IlluminatePaginationLengthAwarePaginator<AppModelsUser>.
I have the impression that I’m missing something in terms of paths or namespaces. But I can’t get through it!
What could be my error ?