Skip to content

InvalidArrayOffset

An array is accessed with a key of the wrong type.

<?php
/** @param array<string, int> $map */
function get(array $map): int {
return $map[0]; // int key used on string-keyed array
}

Use the correct key type as declared in the array’s type annotation.