-
Notifications
You must be signed in to change notification settings - Fork 428
/
bug-6672.php
44 lines (36 loc) · 886 Bytes
/
bug-6672.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php declare(strict_types = 1);
namespace Bug6672;
use function PHPStan\Testing\assertType;
function foo(int $a, ?int $b, int $c, ?int $d, ?int $e, ?int $f): void
{
if ($a > 17) {
assertType('int<18, max>', $a);
} else {
assertType('int<min, 17>', $a);
}
if ($b > 17 || $b === null) {
assertType('int<18, max>|null', $b);
} else {
assertType('int<min, 17>', $b);
}
if ($c < 17) {
assertType('int<min, 16>', $c);
} else {
assertType('int<17, max>', $c);
}
if ($d < 17 || $d === null) {
assertType('int<min, 16>|null', $d);
} else {
assertType('int<17, max>', $d);
}
if ($e >= 17 && $e <= 19 || $e === null) {
assertType('int<17, 19>|null', $e);
} else {
assertType('int<min, 16>|int<20, max>', $e);
}
if ($f < 17 || $f > 19 || $f === null) {
assertType('int<min, 16>|int<20, max>|null', $f);
} else {
assertType('int<17, 19>', $f);
}
}