array-key型
code:php
/**
* @param array<int|string, mixed> $a
* @param array<mixed> $b
*/
function f(array $a, array $b): void
{
foreach ($a as $key => $value) {
\PHPStan\dumpType($key); // Dumped type: int|string
$_ = strlen($key);
// => Parameter #1 $string of function strlen expects string, int|string given. }
foreach ($b as $key => $value) {
\PHPStan\dumpType($key); // Dumped type: (int|string)
$_ = strlen($key);
// No error.
}
}