I just realized that actually that was actually the behavior I expected: look at the method using array casting, it's returning exactly the same data.

The thing is if you want to return all the properties of an object into a PHP array, you have to make a choice: either you keep it simple (keys are property names, values are values) and you skip parent private properties, either you want to include parent privates and then you can end up with different values for the same array key (that's why `(array) $object` results in weird array keys with null characters after all). So it depends of the use case, but here "array casting" and "closure" are coherent: they return the same data.

(actually to be precise there is no handling of key collisions in array casting so you don't really know what you end up with, that could be improved, but maybe later let's not delay to much this PR)