Add PhpVersion param on isSmallerThanOrEqual and isGreaterThanOrEqual#3478
Add PhpVersion param on isSmallerThanOrEqual and isGreaterThanOrEqual#3478ondrejmirtes merged 7 commits intophpstan:2.0.xfrom
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. |
ondrejmirtes
left a comment
There was a problem hiding this comment.
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.
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; | |||
56ad848 to
d145c43
Compare
d145c43 to
8cbbd32
Compare
ondrejmirtes
left a comment
There was a problem hiding this comment.
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.