Skip to content

Commit 5ccbaa6

Browse files
committed
more tests
1 parent 0f98d78 commit 5ccbaa6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-13747.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,35 @@ public function sayHello($list): void
2020
assertType('non-empty-list<int>', $list);
2121
}
2222
}
23+
24+
/** @param list<int> $list */
25+
public function doFoo($list): void
26+
{
27+
if (count($list) === 0) {
28+
return;
29+
}
30+
31+
if (count($list) >= 2) {
32+
assertType('non-empty-list<int>&hasOffsetValue(1, int)', $list);
33+
assertType('int<2, max>', count($list));
34+
} else {
35+
assertType('non-empty-list<int>', $list);
36+
}
37+
}
38+
39+
/** @param list<int> $list */
40+
public function doBar($list): void
41+
{
42+
if (count($list) === 0) {
43+
return;
44+
}
45+
46+
if (2 <= count($list)) {
47+
assertType('non-empty-list<int>&hasOffsetValue(1, int)', $list);
48+
assertType('int<2, max>', count($list));
49+
} else {
50+
assertType('non-empty-list<int>', $list);
51+
assertType('1', count($list));
52+
}
53+
}
2354
}

0 commit comments

Comments
 (0)