Skip to content

Conversation

@princejohnsantillan
Copy link

Currently when using PaginatedDataCollection the items() method does not define the item data type.

Example:

$paginatedData = ExampleData::collect($data, PaginatedDataCollection::class); 

foreach($paginatedData->items()->items() as $item)
{
  /*
   * Problem #1: $item here is mixed 😢
   * Problem #2: items() returning a Paginator isn't intuitive, I expected the actual items. 
   *   We end up needing to do ->items()->items()
   */
}
  • I added @return Paginator<TKey, TValue> to help with static analysis and address problem 1
  • Added data method instead of changing the items method to address problem 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant