Normalize configuration data during config writes
It is important to have consistent YAML files for a sane development workflow. We should reduce unnecessary to a minimum. The current structure of our YAML depends on ConfigEntityBase::toArray(). This means the structure can change after code updates because the order of public properties is different then before.
Currently the config structure is not updated for existing config entities. Because $config->data is initialized after loading with existing data from ConfigCache.
The foreach loop updates the values in $config->data but does not reorder the keys. This means the new configuration is successfully imported but its still marked as modified in our CMI UI because the arrays are not identical.
This produces a lot of modified files in your version control after export because every developer generates different YAML files depending on the initial structure where the config entity was created/imported.
Lets replace the foreach loop with one method call and override the complete array.