-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
[2.0] Add new methods Collection::findFirst and Collection::reduce #252
Conversation
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.
You should probably add docs at https://github.com/doctrine/collections/blob/1.6.x/docs/en/index.rst
tests/Doctrine/Tests/Common/Collections/BaseArrayCollectionTest.php
Outdated
Show resolved
Hide resolved
Probably the 2.0 docs if this is for the next major release. |
I added the documentation. |
tests/Doctrine/Tests/Common/Collections/BaseArrayCollectionTest.php
Outdated
Show resolved
Hide resolved
8402207
@ostrolucky Sorry for the delay ; I made the changes you asked :) |
* | ||
* @psalm-template TReturn | ||
* @psalm-template TInitial | ||
* @psalm-param Closure():TReturn $func |
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.
Parameters are required to specify. Please make sure whole definition works in psalm.dev https://psalm.dev/r/61a6394fe6
Still not it https://psalm.dev/r/b66b6e6a60 |
I think your test is wrong since you're passing string to array_reduce. @ostrolucky |
Is there anything missing to be merged ? |
I don't think so. I am not sure who is responsible for doctrine/collections though. |
Thanks @VincentLanglet ! |
You're welcome. By the way, I saw multiple times that creating a release 2.0 seems impossible since the library will have difficulties to migrate from version 1 and 2. But when I looked at the 2.0 branches, the changes are currently:
What about focusing the feature of the v2 on this point ? (Being compatible with the v2 should allow to be compatible with the v1 easily). For instance:
With this strategy, a reachable 2.0 milestone could be created and released ; Wdyt ? |
If 2.0 is created now, it will mean we have to create 3.0 for new features/BC breaks, so that's unlikely. It's not worth creating 2.0 at this point IMHO, there are not that many changes. |
I didn't ask for creating 2.0 now. But for a reachable milestone. The last major version was in 2013, I'm sure they are some things which can be improved and allow librairies to support both |
Derp, I was just about to create a PR for a similar findFirst method. Is there any reason this is going in 2.0 and not 1.x? |
Adding a method to an interface is a BC-break. |
Hadn't considered that. Thanks for explaining.
…On Thu, 17 Jun 2021, 18:06 Vincent Langlet, ***@***.***> wrote:
Derp, I was just about to create a PR for a similar findFirst method. Is
there any reason this is going in 2.0 and not 1.x?
Adding a method to an interface is a BC-break.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#252 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGP35KHUPHIGZQWLBEM5ELTTIMPDANCNFSM4P5JCYGA>
.
|
@VincentLanglet Both methods are not part of the UPGRADE.md file or am I missing something? |
This is two methods I find useful for the next major.
Collection::find has a better performance than using Collection::filter then Collection::first.
Collection::reduce is similar to array_reduce.
I create this PR to open the discussion about these methods.