New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for generic paginators #1372
Conversation
9fd9c6e
to
c377a16
Compare
f6fc138
to
2d25a23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing. Other than that it looks good!
@@ -28,8 +28,8 @@ abstract class AbstractPaginator implements \Illuminate\Contracts\Support\Htmlab | |||
/** | |||
* @template TValue | |||
* | |||
* @implements \ArrayAccess<mixed, TValue> | |||
* @implements \IteratorAggregate<mixed, TValue> | |||
* @implements \ArrayAccess<array-key, TValue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this class implements ArrayAccess
we should add the offset*
methods here with the correct return/parameter types. This will let PHPStan know User::paginate(10)[3]
returns User
An example can be seen here.
Also for the other classes below + tests for this 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! ✅
That's great. Can you also resolve the conflict? Then if the CI is green, we can merge this! |
fa96aba
to
c1dc9d4
Compare
Errors from Thank you! |
Changes
This PR adds support for generic paginators.
Before:
After:
Breaking changes