forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-13247.php
More file actions
95 lines (82 loc) · 1.49 KB
/
bug-13247.php
File metadata and controls
95 lines (82 loc) · 1.49 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 // lint >= 8.0
declare(strict_types = 1);
namespace Bug13247;
use Traversable;
/**
* @template K as array-key
* @template V
*
* @param array<K, V>|Traversable<K, V> $input
*
* @return array<K, V>
*/
function as_array(array|Traversable $input): array {
return iter_as_array($input);
}
/**
* @template K as array-key
* @template V
*
* @param iterable<K, V> $input
*
* @return array<K, V>
*/
function iter_as_array(iterable $input): array {
return as_array($input);
}
/**
* @param array|Traversable $input
*
* @return array
*/
function as_array2(array|Traversable $input): array {
return iter_as_array2($input);
}
/**
* @param iterable $input
*
* @return array
*/
function iter_as_array2(iterable $input): array {
return as_array2($input);
}
/**
* @param array<int, int>|Traversable<int, int> $input
*
* @return array<int, int>
*/
function as_array3(array|Traversable $input): array {
return iter_as_array3($input);
}
/**
* @param iterable<int, int> $input
*
* @return array<int, int>
*/
function iter_as_array3(iterable $input): array {
return as_array3($input);
}
/**
* @phpstan-template T of iterable<int, int>
*
* @param T $input
*
* @return mixed
*/
function test1(iterable $input) {
test2($input);
iter_as_array($input);
return as_array($input);
}
/**
* @phpstan-template U of Traversable<int, int>|array<int, int>
*
* @param U $input
*
* @return mixed
*/
function test2($input) {
test1($input);
iter_as_array($input);
return as_array($input);
}