fix warning about $tmp in each-helper

`$tmp` might be an object that can be iterated, but array_keys expects to receive an array, so we cast it like that to suppress warnings.