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

Fix return type of Ds\Sequence#copy() #1954

Merged
merged 3 commits into from
Feb 25, 2023

Conversation

MidnightDesign
Copy link
Contributor

@MidnightDesign MidnightDesign commented Nov 3, 2022

I don't know why the return type isn't correctly inferred. It seems fine to me. Any ideas?

Playground link

@MidnightDesign MidnightDesign changed the title Fix return types of copy() methods in Ds\* Fix return type of Ds\Sequence#copy() Nov 3, 2022
@ondrejmirtes
Copy link
Member

The method probably isn't declared on Sequence. The correct solution might be to write @return static above Collection::copy().

@MidnightDesign
Copy link
Contributor Author

I've tried removing copy() from Sequence and making the return type of Collection static<TKey, TValue>, but that didn't change anything. I think it can't work because Collection takes two type arguments, and Sequence takes just one. I have no idea how to fix this.

@ondrejmirtes
Copy link
Member

Try just static

@MidnightDesign
Copy link
Contributor Author

You're right, that works. Thank you for your help!

@MidnightDesign MidnightDesign marked this pull request as ready for review November 4, 2022 10:03
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
Copy link
Member

Thank you!

@MidnightDesign MidnightDesign deleted the ds-copy branch February 26, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants