Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR ensures that an EloquentCollection can also contain non-model values.
Keys are still hardcoded as
int
s this should be changed in the future.The more I looked into properly type-hinting the collection methods using stubs the more I realised what a can of worms I had opened. The return-types of the collection methods can be really counter-intuitive. Take for example:
Another problem with the EloquentCollection methods is that a lot of them use
map()
internally, andmap()
may return either a SupportCollection or an EloquentCollection. However, Laravel's PHPDoc states the return type asstatic
which is technically incorrect and may result in false positives.Further work remains to be done to completely support all the collection magic without any false positives.
Closes #550