Back to Psalm

PossiblyUndefinedIntArrayOffset

docs/running_psalm/issues/PossiblyUndefinedIntArrayOffset.md

6.16.1281 B
Original Source

PossiblyUndefinedIntArrayOffset

Emitted when the config flag ensureArrayIntOffsetsExist is set to true and an integer-keyed offset is not checked for existence

php
<?php

/**
 * @param array<int, string> $arr
 */
function foo(array $arr) : void {
    echo $arr[0];
}