-
Notifications
You must be signed in to change notification settings - Fork 542
Improve loose comparison on union type #3750
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
I think its pretty neat now :) edit: just realized I need to fix the implementations in the accessory types |
This pull request has been marked as ready for review. |
added tests for non-empty-array and non-empty-string to show the intersection-type loose compare is working |
Co-Authored-By: Vincent Langlet <[email protected]>
src/TrinaryLogic.php
Outdated
return self::$registry[$yesNo] ??= new self($yesNo); | ||
} | ||
|
||
public static function createFromBooleanType(BooleanType $type): self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You had the same idea, nice! But I'd actually like BooleanType::toTrinaryLogic()
more :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe I see. done
Thank you! |
closes phpstan/phpstan#8800