Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 22, 2024

Copy link
Member

@ondrejmirtes ondrejmirtes left a 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.

@staabm
Copy link
Contributor Author

staabm commented Dec 22, 2024

I think its pretty neat now :)

edit: just realized I need to fix the implementations in the accessory types

@staabm staabm marked this pull request as draft December 22, 2024 08:33
@staabm staabm marked this pull request as ready for review December 22, 2024 09:11
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm
Copy link
Contributor Author

staabm commented Dec 22, 2024

added tests for non-empty-array and non-empty-string to show the intersection-type loose compare is working

return self::$registry[$yesNo] ??= new self($yesNo);
}

public static function createFromBooleanType(BooleanType $type): self
Copy link
Member

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hehe I see. done

@ondrejmirtes ondrejmirtes merged commit beba172 into phpstan:2.1.x Dec 23, 2024
425 of 426 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the union-loose branch December 23, 2024 19:22
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.

non-strict comparison with union should error

5 participants