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 string types sorting #3441

Merged
merged 2 commits into from
Sep 15, 2024
Merged

Conversation

VincentLanglet
Copy link
Contributor

Needed for #3438 (review)
or testUnion and testUnionReversed doesn't give the same result.

As seen in
https://phpstan.org/r/f9b06e12-01e6-45c2-92dc-2fcd514a5dbb
PHPStan is not consistent about union of strings.

I'm not familiar with the UnionTypeHelper method, so I'm not sure if

if ($a->isString()->yes() && $b->isString()->yes()) {
				return self::compareStrings($a->describe(VerbosityLevel::value()), $b->describe(VerbosityLevel::value()));
			}

is the best fix or if something more generic like

instanceof IntersectionType

should be preferred.

@ondrejmirtes ondrejmirtes merged commit b3c25b8 into phpstan:1.12.x Sep 15, 2024
478 of 500 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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.

2 participants