Skip to content
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

Fix Paginator __construct parameter typehint for phpstan #53615

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

Afrowson
Copy link
Contributor

@Afrowson Afrowson commented Nov 21, 2024

Since the update to v11.32.0
this commit introduced type hints for the Paginator Class. The @param for $items was defined too narrow, restricting the use of Collections, but they are supported and it seems like to be preffered, as the protected setItems() method which is called from within the constructor is supporting Collections and converts any array in to one.

This is not a bugfix as the code works, but a type fix supporting the usage of phpstan/larastan

This PR broadens the type hint for the param $items to be compatible with setItems() by allowing Collections with Tkey and TValue

I did not add null as allowed, although it is supported in the setItems method, but maybe that should be supported as well?

@taylorotwell taylorotwell merged commit 49df42d into laravel:11.x Nov 21, 2024
34 checks passed
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.

2 participants