-
-
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
refactor: unfold
constructor is not variadic anymore
#269
Conversation
|
335b3ec
to
e742c22
Compare
* @param callable((T|U) ...): list<T> $callback | ||
* @param array<int, U> $parameters |
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.
so does this mean that now in $parameters
we want to be able to pass values of different types? What would be a good use case for that?
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.
Yes we could potentially do that, but T
might also be the same as U
.
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.
I gave a second look yesterday and you are perfectly right. I reverted some of the changes.
It's ready again for review.
00af91e
to
3628b2f
Compare
3628b2f
to
d424e71
Compare
interface Unfoldable | ||
{ | ||
/** | ||
* Create a collection by yielding from a callback with an initial value. | ||
* | ||
* @see https://loophp-collection.readthedocs.io/en/stable/pages/api.html#unfold | ||
* | ||
* @template T | ||
* @template U of T |
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.
I'm not sure why this is needed - doesn't it work if we leave it like before, just T
? Either way I guess it's the same thing
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.
Nope it doesn't work. This is a static function, so, U
must be defined locally at the method level. And U
is going to be made of T
.
This PR:
Follows #. Related to #. Fixes #.