Motivation
- Typed has the concept of lists and complex data, however there is general notion of general "data containers". That makes navigating in a tree of typed data unnecessarily complex as there is no fitting "data container" interface for the parent object of properties or list items.
- We have quite some methods that both interfaces (List + Complex data) share, e.g. get(), set(), isEmpty() - having this in a common container interface allows us to easily make use of those when working with data parent objects (e.g. the result of getParent()).
- Meanwhile, there is a TraversableTypedDataInterface which was aided as band-aid but fails to deliver the semantic meaning or
- When mapping data structures to typed data which neither are a fit for list interface or complex data interface, it's possible to stick to DataContainerInterface then. This is the case for sequences of config schema and therefore would help solving https://www.drupal.org/node/1928868.
Proposed resolution
Extract a common interface: DataContainerInterface. According to wikipedia, a container can either be a list or complex data.
As complex data and lists use different terminology for their contained data it probably makes sense to keep shared methods overridden in those interface for better documentation.
Then, as there no use left for TraversableTypedDataInterface we should deprecate that in favour of DataContainerInterface.
Remaining tasks
Do it.
User interface changes
-
API changes
None - we could decide to add some type-hint to DataContainerInterface somewhere if we want to though.