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

Builder::paginate() Return value type is incorrect #741

Closed
Yi-pixel opened this issue Dec 14, 2018 · 2 comments
Closed

Builder::paginate() Return value type is incorrect #741

Yi-pixel opened this issue Dec 14, 2018 · 2 comments

Comments

@Yi-pixel
Copy link

Hi,This problem has been bothering me.Because it still exists in multiple versions.

When I try to call the paginate() method at the end of the model, the return value it gives me should be
Illuminate\Pagination\LengthAwarePaginator Instead of \Illuminate\Contracts\Pagination\LengthAwarePaginator defined in _ide_helper.php, Although this should not seem too much of a problem, because \Illuminate\Contracts\Pagination\LengthAwarePaginator implements Illuminate\Contracts\Support\Arrayable which makes it possible to call the toArray method after paginate() Serialize, then modify the data column inside, although it is now working, but in PHPStorm will show the exception highlighting of the method does not exist.
Because I know this may not be a bug, or because of some features such as Contracts, so I didn't intend to submit a pull request, so I would like to ask if I can solve this problem.


Of course, I do this because I need to modify the data in the return value of paginate() and keep the original paging data structure. Maybe you can have better.
image

@stale
Copy link

stale bot commented Jul 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

@stale stale bot added the stale label Jul 29, 2020
@Yi-pixel
Copy link
Author

I think this is a feature of the Laravel container, because here is only the return value declared as an interface, it is really impossible to know which specific object the interface is bound to behind the container, so the type hint here directly uses the interface, it should be Correct, but I need to do another treatment in the IDE prompt of my project.

Perhaps this extension should be able to do the same.

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

No branches or pull requests

1 participant