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

implement isInteger() on Type #1971

Merged
merged 2 commits into from Nov 6, 2022
Merged

implement isInteger() on Type #1971

merged 2 commits into from Nov 6, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 6, 2022

@staabm
Copy link
Contributor Author

staabm commented Nov 6, 2022

Memo to me: adjust per loose comparison rules

@ondrejmirtes
Copy link
Member

Memo to me: adjust per loose comparison rules

No. Only an integer is an integer.

@ondrejmirtes
Copy link
Member

ondrejmirtes commented Nov 6, 2022

It's up to Type::looseCompare() to tell that int == string might be true by asking $otherType->isInteger()->or($otherType->isString()) in IntegerType::looseCompare().

@staabm staabm marked this pull request as ready for review November 6, 2022 11:34
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 4cc6f2a into phpstan:1.9.x Nov 6, 2022
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the is-int branch November 6, 2022 11:39
@herndlm
Copy link
Contributor

herndlm commented Nov 6, 2022

👍 I wanted to do the same later today :)

@staabm
Copy link
Contributor Author

staabm commented Nov 6, 2022

We also need it for bool and float :-)

@staabm
Copy link
Contributor Author

staabm commented Nov 6, 2022

I am working on bool now

@herndlm
Copy link
Contributor

herndlm commented Nov 6, 2022

Go ahead, I won't be working on something today any more.

@staabm
Copy link
Contributor Author

staabm commented Nov 7, 2022

working on isFloat now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants