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

Change Collection::slice() method to return an instance of Collection #196

Closed
wants to merge 1 commit into from

Conversation

jwage
Copy link
Member

@jwage jwage commented Apr 30, 2019

Fixes #195

@jwage jwage added this to the 2.0.0 milestone Apr 30, 2019
*
* @psalm-return array<TKey,T>
* @psalm-return Collection<TKey, T>
Copy link
Member

@greg0ire greg0ire May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add @return static here, and then change the return type hints of implementors to self when dropping php 7.3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. Can that be done in another issue/PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! It's a tiny detail, definitely not a blocker

@@ -268,7 +268,7 @@ public function indexOf($element)
/**
* {@inheritDoc}
*/
public function slice(int $offset, ?int $length = null) : array
public function slice(int $offset, ?int $length = null) : Collection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the impact of this BC break on the OSS ecosystem? Is ->slice() called often?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. Trying to think of a way to search for that on github somehow.

@jwage jwage force-pushed the slice-return-collection branch from ab0fc76 to c694975 Compare May 1, 2019 20:49
Base automatically changed from master to 2.0.x January 19, 2021 07:24
@greg0ire
Copy link
Member

Oh I just noticed this has been taken over already.

Closing in favor of #264

@greg0ire greg0ire closed this Aug 24, 2022
@alcaeus alcaeus removed this from the 2.0.0 milestone Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

slice() method should return a Collection instead of an array
4 participants