Task: We need to be able to convert CompositeData object into non-flat array (with the structure intact).  Note, that the current functionality that is covered by tests is required (used in the other places of the project), so all the current tests must still pass.

So
 $compositeData->objectA->value = 'moo';
 $compositeData->objectB->something = 'boo';
 $compositeData->objectC->value = 'heythere';

Will become
[
 ['objectA'] => ['value'  => 'moo'],
 ['objectB'] => ['something' => 'boo'],
 ['objectC'] => ['value' => 'heythere']
]

Solution:
Obviously, the only mismatch comparing to the current realization is an object name as a key in the resulting array ('objectA' => ...).
CompositeHashData adds up the hash key to the internal objects storage, and uses those keys when toArray is generating an array.
At the same time previous code is not changed, and therefore works the same way as before.