Skip to content

Commit 9d8c80e

Browse files
committed
more tests
1 parent 17c48e8 commit 9d8c80e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/PHPStan/Analyser/nsrt/count-recursive.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,27 @@ public function countListNormal($list): void
9999
}
100100
}
101101

102+
public function countImplicitNormal($mode): void
103+
{
104+
$arr = [1, 2, 3];
105+
if (count($arr, $mode) > 2) {
106+
assertType('3', count($arr));
107+
assertType('3', count($arr, $mode));
108+
assertType('3', count($arr, COUNT_NORMAL));
109+
assertType('3', count($arr, COUNT_RECURSIVE));
110+
}
111+
}
112+
113+
public function countMixed($arr, $mode): void
114+
{
115+
if (count($arr, $mode) > 2) {
116+
assertType('int<0, max>', count($arr));
117+
assertType('int<3, max>', count($arr, $mode));
118+
assertType('int<0, max>', count($arr, COUNT_NORMAL));
119+
assertType('int<0, max>', count($arr, COUNT_RECURSIVE));
120+
}
121+
}
122+
102123
/** @param list<int> $list */
103124
public function countListRecursive($list): void
104125
{

0 commit comments

Comments
 (0)