-
Notifications
You must be signed in to change notification settings - Fork 4
Feat: add iterable_merge function #45
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #45 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 44 59 +15
=========================================
+ Hits 44 59 +15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Hi @jdecool,
Thanks for your contribution & sorry for the late reply!
The following case does not succeed:
$array1 = ['bar', 'baz'];
$array2 = ['bat', 'baz'];
$generator1 = fn () => yield from $array1;
$generator2 = fn () => yield from $array2;
expect(iterable_merge($generator1(), $generator2())->asArray())->toEqual(array_merge($array1, $array2));
No problem @bpolaszek I've just pushed some updates. |
Sounds good to me 🙂 Can you please fix CI + advertise it in Thanks! 🙏 |
Sure, everything should be OK now. |
😮 it fails. Sorry i’ve missed one check |
Everything is fine now is the CI 😌 |
Thanks @jdecool, your contribution is very much appreciated! 👍 |
/** | ||
* Merge iterables | ||
* | ||
* @param iterable<TKey, TValue> ...$args |
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.
BTW I think this template will not work for merging iterables with different value types.
Also it seems, there's no support for typing it properly phpstan/phpstan#3814 (comment)
Nice feature :) |
Add
iterable_merge
function.