MIR0230
InvalidMethodCall
A method is called with ->method() on a value that is a scalar or array. At runtime this
throws an Error.
Example
Section titled “Example”<?phpfunction label(string $item): string { return $item->label(); // string is not an object}How to fix
Section titled “How to fix”Ensure the value is an object before calling methods on it, or fix the type annotation:
<?phpfunction label(Item $item): string { return $item->label();}