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

Return correct collection instance when calling all #454

Merged
merged 9 commits into from
Feb 5, 2020

Conversation

BertvanHoekelen
Copy link
Contributor

@BertvanHoekelen BertvanHoekelen commented Feb 5, 2020

Fixes #452

Calling User::all(); returned a Eloquent/Collection. This PR makes sure a Support/Collection is returned so that User::all()->first() returns a User|null.

@szepeviktor
Copy link
Collaborator

szepeviktor commented Feb 5, 2020

Thank you for you PR!
https://www.php.net/manual/en/function.in-array.php
in_array returns a boolean. Could you please correct the code?

@BertvanHoekelen
Copy link
Contributor Author

@szepeviktor Done!

@szepeviktor
Copy link
Collaborator

Thanks.
Could you add a 3rd parameter true to get in_array work in a strict mode?

src/ReturnTypes/ModelExtension.php Outdated Show resolved Hide resolved
tests/Features/Methods/ModelExtension.php Outdated Show resolved Hide resolved
src/ReturnTypes/ModelExtension.php Outdated Show resolved Hide resolved
@szepeviktor szepeviktor self-requested a review February 5, 2020 16:43
@canvural canvural merged commit 5a87fe0 into larastan:master Feb 5, 2020
@BertvanHoekelen BertvanHoekelen deleted the collection-all-first-fix branch February 6, 2020 08:51
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.

Collection doesn't return correct model instance
4 participants