forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-10627.php
More file actions
95 lines (81 loc) · 1.91 KB
/
bug-10627.php
File metadata and controls
95 lines (81 loc) · 1.91 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
namespace Bug10627;
use function array_is_list;
use function PHPStan\Testing\assertType;
class HelloWorld
{
public function sayHello(): void
{
$list = ['A', 'C', 'B'];
natcasesort($list);
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello2(): void
{
$list = ['A', 'C', 'B'];
natsort($list);
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello3(): void
{
$list = ['A', 'C', 'B'];
arsort($list);
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello4(): void
{
$list = ['A', 'C', 'B'];
asort($list);
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello5(): void
{
$list = ['A', 'C', 'B'];
ksort($list);
assertType("array{'A', 'C', 'B'}", $list);
assertType('true', array_is_list($list));
}
public function sayHello6(): void
{
$list = ['A', 'C', 'B'];
uasort($list, function () {
});
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello7(): void
{
$list = ['A', 'C', 'B'];
uksort($list, function () {
});
assertType("array{'A', 'C', 'B'}", $list);
assertType('bool', array_is_list($list));
}
public function sayHello8(): void
{
$list = ['A', 'C', 'B'];
krsort($list);
assertType("array{2: 'B', 1: 'C', 0: 'A'}", $list);
assertType('false', array_is_list($list));
}
/**
* @param list<string> $list
* @return void
*/
public function sayHello9(array $list): void
{
krsort($list);
assertType("array<int<0, max>, string>", $list);
}
public function sayHello10(): void
{
$list = ['a' => 'A', 'c' => 'C', 'b' => 'B'];
krsort($list);
assertType("array{c: 'C', b: 'B', a: 'A'}", $list);
assertType('false', array_is_list($list));
}
}