The expression $rows of type null|array is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
$collection=json_decode($data,true);if(!is_array($collection)){thrownew\RuntimeException('$collection must be an array.');}foreach($collectionas$item){/** ... */}
If you are sure that the expression is traversable, you might want to add a
doc comment cast to improve IDE auto-completion and static analysis:
The method TYPO3\CMS\Backend\Utilit...etSpriteIconForRecord() has been deprecated with message: since TYPO3 CMS 7, will be removed with TYPO3 CMS 8
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be
removed from the class and what other method or class to use instead.
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.