Skip to content

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