Skip to content
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

Make Iterator covariant #2457

Merged
merged 1 commit into from
Sep 26, 2022
Merged

Make Iterator covariant #2457

merged 1 commit into from
Sep 26, 2022

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Aug 27, 2022

Q A
Type improvement
BC Break no
Fixed issues

Summary

Since \Iterator is covariant, the mongo Iterator could be too.

This allows to write

/**
 * @template-covariant T of object
 */
interface MyCustomClass 
{
     /** @return Iterator<T> */
     public function getIrator(): Iterator
}

or to pass an Iterator to a method which works on Iterator

@malarzm
Copy link
Member

malarzm commented Sep 20, 2022

@VincentLanglet we've managed to get checks back to shape. May I ask you to rebase your PR atop newly created 2.5.x branch?

@VincentLanglet VincentLanglet changed the base branch from 2.4.x to 2.5.x September 20, 2022 23:03
@VincentLanglet
Copy link
Contributor Author

@VincentLanglet we've managed to get checks back to shape. May I ask you to rebase your PR atop newly created 2.5.x branch?

Sure, done

@malarzm malarzm added this to the 2.5.0 milestone Sep 26, 2022
@malarzm malarzm merged commit 4e6423a into doctrine:2.5.x Sep 26, 2022
@malarzm
Copy link
Member

malarzm commented Sep 26, 2022

Thanks @VincentLanglet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants