forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bug-2648.php
53 lines (43 loc) · 986 Bytes
/
bug-2648.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
45
46
47
48
49
50
51
52
53
<?php
namespace Bug2648;
use function PHPStan\Testing\assertType;
class Foo
{
/**
* @param bool[] $list
*/
public function doFoo(array $list): void
{
if (count($list) > 1) {
assertType('int<2, max>', count($list));
unset($list['fooo']);
assertType('array<bool>', $list);
assertType('int<0, max>', count($list));
}
}
/**
* @param bool[] $list
*/
public function doBar(array $list): void
{
if (count($list) > 1) {
assertType('int<2, max>', count($list));
foreach ($list as $key => $item) {
assertType('0|int<2, max>', count($list));
if ($item === false) {
unset($list[$key]);
assertType('int<0, max>', count($list));
}
assertType('int<0, max>', count($list));
if (count($list) === 1) {
assertType('1', count($list));
$list[] = false;
assertType('int<1, max>', count($list));
break;
}
}
assertType('int<0, max>', count($list));
}
assertType('int<0, max>', count($list));
}
}