<?php
class User
{
}
/** @var list<array{name:string,data:User}> */
$listOfUsers = 1;
foreach ($listOfUsers as $item) {
$item['data']-> // no autocomplete
}
in case of array shape with only 1 element, it works. In addition, currently array shape only suggests up to 2 array keys