-
Notifications
You must be signed in to change notification settings - Fork 471
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
Add PhpVersion param on isSmallerThanOrEqual and isGreaterThanOrEqual #3478
Conversation
You've opened the pull request against the latest branch 2.0.x. PHPStan 2.0 is not going to be released for months. If your code is relevant on 1.12.x and you want it to be released sooner, please rebase your pull request and change its target to 1.12.x. |
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.
Also other potential methods to add it to:
- getSmallerType
- getSmallerOrEqualType
- getGreaterType
- getGreaterOrEqualType
src/Type/CompoundType.php
Outdated
@@ -16,6 +17,6 @@ public function isAcceptedWithReasonBy(Type $acceptingType, bool $strictTypes): | |||
|
|||
public function isGreaterThan(Type $otherType): TrinaryLogic; |
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.
What about here?
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.
Indeed, var_dump('' < 0);
is true on PHP 8 but false on PHP 7.4
src/Type/Type.php
Outdated
@@ -217,7 +217,7 @@ public function toArrayKey(): Type; | |||
|
|||
public function isSmallerThan(Type $otherType): TrinaryLogic; |
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.
What about here?
56ad848
to
d145c43
Compare
d145c43
to
8cbbd32
Compare
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.
Mention it in UPGRADING.md in minor breaks section at the bottom. Thanks!
I think we need a similar PR for methods which currently use |
That would be awesome! |
It's used by
Changing the signature of
And changing those signature lead to too many changes... |
Yeah, I wouldn't want to do this for |
Thank you. |
As recommended in phpstan/phpstan#11732 (comment)
I'll do the implementation/fix in another PR, to be sure to not delay the signature update.