Skip to content

Commit 7db5ac6

Browse files
committed
test integer ranges
1 parent 72ac21c commit 7db5ac6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tests/PHPStan/Analyser/nsrt/loose-comparisons-php8.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,22 @@ public function sayEmptyStr(
5050
/**
5151
* @param 'php' $phpStr
5252
* @param '' $emptyStr
53+
* @param int<10, 20> $intRange
5354
*/
5455
public function sayInt(
5556
$emptyStr,
5657
$phpStr,
57-
int $int
58+
int $int,
59+
int $intRange
5860
): void
5961
{
6062
assertType('false', $int == $emptyStr);
6163
assertType('false', $int == $phpStr);
6264
assertType('false', $int == 'a');
65+
66+
assertType('false', $intRange == $emptyStr);
67+
assertType('false', $intRange == $phpStr);
68+
assertType('false', $intRange == 'a');
6369
}
6470

6571
}

tests/PHPStan/Analyser/nsrt/loose-comparisons.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ public function sayEmptyStr(
616616
* @param array{} $emptyArr
617617
* @param 'php' $phpStr
618618
* @param '' $emptyStr
619+
* @param int<10, 20> $intRange
619620
*/
620621
public function sayInt(
621622
$true,
@@ -631,6 +632,7 @@ public function sayInt(
631632
$emptyArr,
632633
array $array,
633634
int $int,
635+
int $intRange,
634636
): void
635637
{
636638
assertType('bool', $int == $true);
@@ -645,6 +647,10 @@ public function sayInt(
645647
assertType('bool', $int == $null);
646648
assertType('false', $int == $emptyArr);
647649
assertType('false', $int == $array);
650+
651+
assertType('false', $intRange == $emptyArr);
652+
assertType('false', $intRange == $array);
653+
648654
}
649655

650656
}

0 commit comments

Comments
 (0)