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

Treat ArrayType as covariant in its keys and values #2465

Merged
merged 2 commits into from
Jun 17, 2023

Conversation

jiripudil
Copy link
Contributor

Following up on #2464, I believe the implementation in ArrayType can be simplified accordingly

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@jiripudil jiripudil changed the base branch from 1.11.x to 1.10.x June 17, 2023 13:54
@ondrejmirtes
Copy link
Member

Is there a situation where the behaviour is different? Would be nice to have a test that fails without this change :)

This should be safe because it is copy-on-write
@jiripudil
Copy link
Contributor Author

Actually, there is. Added a test. It looks like edge cases, but I guess it could happen that this change introduces new errors for someone 😬

@ondrejmirtes
Copy link
Member

I just checked the last PR that touched this: https://github.com/phpstan/phpstan-src/pull/30/files

And looks like all the tests that were added back then still pass :)

Thank you!

@ondrejmirtes ondrejmirtes merged commit 5a1a6af into phpstan:1.10.x Jun 17, 2023
375 of 378 checks passed
@jiripudil jiripudil deleted the simplify-array-variance branch June 17, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants