typing an array as an object to remove php exceptions