Skip to content

NullArrayAccess

Array access is performed on a value that is possibly null.

<?php
function getList(): ?array { return null; }
echo getList()[0]; // may be null

Guard with a null check before accessing array elements.