Here's a simple example that generates UndefinedVariable for the second $item in the array.
$fn = fn($item) => [
$item,
fn($arg) => $arg,
$item,
];
This works fine.
$fn = function($item) {
return [
$item,
fn($arg) => $arg,
$item,
];
}
I am using v2.11.19 but the issue has been around for years, I've just never gotten around to opening an issue.