Closed
Description
Laravel Version
10.48.8
PHP Version
8.3.4
Database Driver & Version
mysql Ver 8.3.0 for macos14.2 on arm64 (Homebrew)
Description
The paginate() method of the Illuminate\Database\Eloquent\Builder
returns the interface LengthAwarePaginator
, which implements the Paginator
interface (also on master):
https://github.com/laravel/framework/blob/master/src/Illuminate/Contracts/Pagination/Paginator.php#L5
This interface does not implement the through() method, even though this is a part of AbstractPaginator
. This causes my IDE to place red lines:
$pokemon = Pokemon::query()
->paginate(30)
->through(static fn (Pokemon $pokemon): PokemonData => PokemonData::fromModel($pokemon));
Undefined method 'through'.
Can we add this method to the Paginator
interface to prevent these errors?
Steps To Reproduce
Paginate any model and call the through() method. It should work fine, but the IDE will give an error.
Metadata
Metadata
Assignees
Labels
No labels