InvalidArgumentException thrown

Passed variable is not an array or object