-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Update Span and Partition operations. #148
Conversation
e44d50b
to
5cf143d
Compare
@AlexandruGG Let me know what you think. I think this is clearly an improvement. |
5cf143d
to
332c542
Compare
332c542
to
ec3ecf9
Compare
ec3ecf9
to
ff9f05b
Compare
@drupol hey, so if I understand correctly the main issue is that I'm thinking I can update the documentation to mention this and fix the static analysis as well |
Yes exactly, and it make sense actually, I don't know why I haven't though about this earlier. |
Cool 😄. I thought about it at first but then I also was assuming that with Collection and ClosureIterator we want to still allow that. But it makes sense to keep it consistent with how a Generator would work by itself |
Leave this to me, I'll fix the static analysis and update the docs |
As a closure is the real immutable thing in PHP, we must use and abuse them 💪 |
Thanks :) and ok, I don't touch this anymore. |
Yes ! We could imagine fixing it by detecting if the |
.. tip:: This can be very useful when working with a PHP `Generator`_, since it will allow the collection | ||
object to behave as if the Generator was rewindable. | ||
|
||
Signature: ``Collection::fromCallable(callable $callable, iterable $parameters = []): Collection;`` |
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.
don't forget to update these when changing method signatures 😬
#146
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.
Oops! Thanks!
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.
This should be good to go. Here's what I did:
- updated docs to mention the Generator behaviour. We can further update once feat: Add
::fromGenerator
constructor. #150 is ready - fixed static analysis - required being a bit more verbose in the Collection.php methods and in the operations but works
- moved the new tests into the existing partition test
A nice one done! And a good lesson learned :) |
Thanks for the help @AlexandruGG ! |
Thank you for fixing this 🚀 |
This PR: