Skip to content

Commit 5e74532

Browse files
committed
add tests
1 parent 6a8122e commit 5e74532

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@
66

77
class HelloWorld
88
{
9+
public function countUnknownArray(array $arr): void
10+
{
11+
assertType('array', $arr);
12+
assertType('int<0, max>', count($arr));
13+
assertType('int<0, max>', count($arr, COUNT_NORMAL));
14+
assertType('int<0, max>', count($arr, COUNT_RECURSIVE));
15+
}
16+
17+
public function countEmptyArray(array $arr): void
18+
{
19+
if (count($arr) == 0) {
20+
assertType('array{}', $arr);
21+
assertType('0', count($arr));
22+
assertType('0', count($arr, COUNT_NORMAL));
23+
assertType('0', count($arr, COUNT_RECURSIVE));
24+
}
25+
}
26+
927
public function countArray(array $arr): void
1028
{
1129
if (count($arr) > 2) {

0 commit comments

Comments
 (0)