Improve loose comparison on union type#3750
Merged
ondrejmirtes merged 7 commits intophpstan:2.1.xfrom Dec 23, 2024
Merged
Conversation
ondrejmirtes
requested changes
Dec 22, 2024
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
Would ve great to do it with IntersectionType too.
I suspect the implementations should resemble TrinaryLogic::minMax and extremeIdentity so I want to compare them with that.
Contributor
Author
|
I think its pretty neat now :) edit: just realized I need to fix the implementations in the accessory types |
staabm
commented
Dec 22, 2024
Collaborator
|
This pull request has been marked as ready for review. |
Contributor
Author
|
added tests for non-empty-array and non-empty-string to show the intersection-type loose compare is working |
Co-Authored-By: Vincent Langlet <VincentLanglet@users.noreply.github.com>
mvorisek
reviewed
Dec 22, 2024
ondrejmirtes
requested changes
Dec 23, 2024
src/TrinaryLogic.php
Outdated
| return self::$registry[$yesNo] ??= new self($yesNo); | ||
| } | ||
|
|
||
| public static function createFromBooleanType(BooleanType $type): self |
Member
There was a problem hiding this comment.
You had the same idea, nice! But I'd actually like BooleanType::toTrinaryLogic() more :)
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes phpstan/phpstan#8800