MIR0218
InvalidPropertyFetch
A property is accessed with ->prop on a value that is not an object. At runtime this will
produce a fatal error.
Example
Section titled “Example”<?phpfunction getLabel(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 accessing its properties, or fix the type annotation:
<?phpfunction getLabel(Item $item): string { return $item->label;}