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

Added ArrayFlipFunctionReturnTypeExtension, Cover non-empty-array in array_flip #583

Merged
merged 26 commits into from Jul 20, 2021

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jul 19, 2021

@staabm
Copy link
Contributor Author

staabm commented Jul 19, 2021

Todo: add more test coverage

@staabm staabm closed this Jul 19, 2021
@staabm staabm reopened this Jul 19, 2021
Comment on lines 48 to 50
if ($argType->isIterableAtLeastOnce()->yes()) {
$flippedArrayType = TypeCombinator::intersect($flippedArrayType, new NonEmptyArrayType());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the actual feature I primarily want to implement with this PR.

regarding the key/type flipping I did a lot of guesswork.. I need some guidance on how this should look like :-/

@staabm staabm marked this pull request as ready for review July 20, 2021 12:30
@staabm
Copy link
Contributor Author

staabm commented Jul 20, 2021

turns out I had a typo in my tests. should be good to go.

@staabm staabm changed the title Cover non-empty-array in array_flip Added ArrayFlipFunctionReturnTypeExtension, Cover non-empty-array in array_flip Jul 20, 2021
@staabm staabm changed the title Added ArrayFlipFunctionReturnTypeExtension, Cover non-empty-array in array_flip Added ArrayFlipFunctionReturnTypeExtension, Cover non-empty-array in array_flip Jul 20, 2021
@ondrejmirtes ondrejmirtes merged commit 3ee46e7 into phpstan:master Jul 20, 2021
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the patch-1 branch July 20, 2021 16:36
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