This function may return any type, not just scalar, for some Iterator types. In particular, it is very trivial to write a generator function that yields arbitrary keys:
<?php
function foo() {
yield null => 1;
yield new stdclass => 2;
}
?>