I think if you do `(string)$query` that would be sufficient.