forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14550.php
More file actions
126 lines (106 loc) · 2.44 KB
/
bug-14550.php
File metadata and controls
126 lines (106 loc) · 2.44 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php // lint >= 8.1
declare(strict_types = 1);
namespace Bug14550;
use function PHPStan\Testing\assertType;
/**
* @param list<string> $list
*/
function crashArrayKeyFirst(array $list): void
{
$fn = array_key_first(...);
assertType('Closure(array): (int|string|null)', $fn);
}
/**
* @param list<string> $list
*/
function crashArrayKeyLast(array $list): void
{
$fn = array_key_last(...);
assertType('Closure(array): (int|string|null)', $fn);
}
/**
* @param list<string> $list
*/
function crashArrayRand(array $list): void
{
$fn = array_rand(...);
assertType('(Closure(non-empty-array): (int|string))|(Closure(non-empty-array, int<1, max>): (array<int, int|string>|int|string))', $fn);
}
/**
* @param list<string> $list
*/
function crashArraySearch(array $list, string $s): void
{
$fn = array_search(...);
assertType('Closure(mixed, array, bool=): (int|string|false)', $fn);
}
function testStrlen(): void
{
$fn = strlen(...);
assertType('Closure(string): int<0, max>', $fn);
}
function testMbStrlen(): void
{
$fn = mb_strlen(...);
assertType('Closure(string, string|null=): int<0, max>', $fn);
}
function testCount(): void
{
$fn = count(...);
assertType('Closure(array|Countable, 0|1=): int<0, max>', $fn);
}
function testSizeof(): void
{
$fn = sizeof(...);
assertType('Closure(array|Countable, int=): int', $fn);
}
function testPregMatch(): void
{
$fn = preg_match(...);
assertType('Closure(string, string, array<string>|null=, TFlags=, int=): (0|1|false)', $fn);
}
function testGettype(): void
{
$fn = gettype(...);
assertType('Closure(mixed): string', $fn);
}
function testGetClass(): void
{
$fn = get_class(...);
assertType('Closure(object=): class-string', $fn);
}
function testGetDebugType(): void
{
$fn = get_debug_type(...);
assertType('Closure(mixed): string', $fn);
}
function testGetParentClass(): void
{
$fn = get_parent_class(...);
assertType('Closure(object|string=): (class-string|false)', $fn);
}
function testTrim(): void
{
$fn = trim(...);
assertType('Closure(string, string=): string', $fn);
}
function testLtrim(): void
{
$fn = ltrim(...);
assertType('Closure(string, string=): string', $fn);
}
function testRtrim(): void
{
$fn = rtrim(...);
assertType('Closure(string, string=): string', $fn);
}
/**
* @param list<string> $list
*/
function testArrayKeysInForeach(array $list): void
{
foreach (array_keys(...) as $key) {
}
$fn = array_keys(...);
assertType('Closure(array, mixed=, bool=): list<int|string>', $fn);
}