PossiblyInvalidArrayAccess
Array access is performed on a value that might not be an array.
Example
Section titled “Example”<?phpfunction first(array|false $rows): mixed { return $rows[0]; // $rows might be false}How to fix
Section titled “How to fix”Guard with a type check before the array access.
<?phpfunction first(array|false $rows): mixed { if ($rows === false) { return null; } return $rows[0];}