Skip to content

Commit d547ddc

Browse files
authored
Merge branch refs/heads/1.12.x into 2.0.x
2 parents e8027e7 + 06ab320 commit d547ddc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

stubs/arrayFunctions.stub

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ function array_reduce(
1616
$three = null
1717
) {}
1818

19+
/**
20+
* @template T of mixed
21+
*
22+
* @param array<T> $array
23+
* @return ($array is non-empty-array ? non-empty-list<T> : list<T>)
24+
*/
25+
function array_values(array $array): array {}
26+
1927
/**
2028
* @template TKey as (int|string)
2129
* @template T

tests/PHPStan/Analyser/nsrt/array_values.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ public function constantArrayType(): void
3737
);
3838
assertType("array{0?: 'a'|'b'|'c', 1?: 'b'|'c', 2?: 'c'}", array_values($numbers));
3939
}
40+
41+
/**
42+
* @param array<string, non-empty-array<string, int>> $a
43+
*/
44+
public function arrayMap(array $a): void
45+
{
46+
assertType('array<string, non-empty-list<int>>', array_map(array_values(...), $a));
47+
}
4048
}

0 commit comments

Comments
 (0)