Help wantedenhancement
仓库指标
- 星标
- (5,369 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Given the following code:
/**
* @param array<array{tags: string}> $a
*/
function test(array $a): string
{
return array_reduce($a, function (string $carry, array $value) {
return $carry . $value['tags'];
}, '');
}
Psalm is unable to infer a type for $value in the callback function given to array_reduce():
https://psalm.dev/r/b9e02bcaaa
In this example, it should infer the type as array{tags: string}.
Can this be fixed?