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

貢獻者指南