if you didn't reduce the code, it would look like that, yes ... the
$return = (array)$return
is only necessary in the shortened version; it turns $return
into an array with one element if it's not an array, otherwise it does nothing.