Skip to content

implement isInteger() on Type#1971

Merged
ondrejmirtes merged 2 commits intophpstan:1.9.xfrom
staabm:is-int
Nov 6, 2022
Merged

implement isInteger() on Type#1971
ondrejmirtes merged 2 commits intophpstan:1.9.xfrom
staabm:is-int

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Nov 6, 2022

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Nov 6, 2022

Memo to me: adjust per loose comparison rules

@ondrejmirtes
Copy link
Copy Markdown
Member

Memo to me: adjust per loose comparison rules

No. Only an integer is an integer.

@ondrejmirtes
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Thank you.

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

herndlm commented Nov 6, 2022

👍 I wanted to do the same later today :)

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Nov 6, 2022

We also need it for bool and float :-)

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Nov 6, 2022

I am working on bool now

@herndlm
Copy link
Copy Markdown
Contributor

herndlm commented Nov 6, 2022

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

@staabm
Copy link
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

4 participants