vimeo/psalm

array_walk_recursive changes variable type to incorrect

开放

#5,767 创建于 2021年5月14日

 (2 条评论) (1 个反应) (0 位负责人)PHP (668 个派生)batch import
good first issuetype providers

仓库指标

星标
 (5,369 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

I have an array array<int, array<int, int>>, that I pass to array_walk_recursive.

The first parameter in the callback function int &$id I take by reference, then I change the value to a different type. (e.g.: string) Though I define the @param-out string $id annotation, the inferred type is not what it expected.

Expected: array<int, array<int, string>> Inferred: array<array-key, mixed>

https://psalm.dev/r/097021124e

贡献者指南