forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14549.php
More file actions
52 lines (42 loc) · 1.01 KB
/
Copy pathbug-14549.php
File metadata and controls
52 lines (42 loc) · 1.01 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
<?php
namespace Bug14549;
use function PHPStan\Testing\assertType;
class Foo
{
/**
* @param callable-array $task
*/
public function doFoo(array $task): void
{
foreach($task as $k => $v) {
assertType('0|1', $k);
assertType('object|non-falsy-string', $v);
}
assertType('class-string|object', $task[0]);
assertType('non-falsy-string', $task[1]);
}
/**
* @param non-empty-list<string> $list
*/
public function doBar(array $list): void
{
if ($list[0] !== '') {
assertType('non-empty-list<string>&hasOffsetValue(0, non-empty-string)', $list);
if (is_callable($list)) {
assertType('non-empty-list<string>&callable(): mixed&hasOffsetValue(0, non-empty-string)', $list);
assertType('non-empty-string', $list[0]);
assertType('non-falsy-string', $list[1]);
foreach($list as $k => $v) {
assertType('0|1', $k);
assertType('non-falsy-string', $v);
}
}
}
}
/**
* @param (array&callable(array): array) $array
*/
public function doIntersection($array): void
{
}
}