MIR0219
InvalidArrayAccess
The [key] bracket access syntax is used on a value whose type does not support it. Only
arrays, strings, and objects implementing ArrayAccess (or Countable/Traversable in some
contexts) support bracket access.
Example
Section titled “Example”<?phpfunction first(int $value): mixed { return $value[0]; // int does not support array access}How to fix
Section titled “How to fix”Ensure the value is an array, string, or ArrayAccess before using bracket notation.