rdlowrey/Auryn — pull request #2 by ascii-soup (2013-07-08 13:42:19+00:00)
Title: Inheriting definitions from parent classes + "merging" custom definitions

I really like this library and wish to add some functionality to it which would simplify DI configuration in certain circumstances.

- Parent class definitions will be inherited by child classes when make() is called.
- Custom definitions will be now merged with existing definitions, as opposed to replacing them entirely.

The changes contained in this PR are there to reduce some of the duplication that can occur in the configuration of a DIC. Some object families (like controllers, for example) have a shallow, wide class hierarchy, with a parent constructor that takes dependencies needed by all the children (request/response objects, perhaps, to continue with the controller example) and this can be frustrating to configure with a DIC due to all the duplication. This PR aims to mitigate that problem and provide additional readability - when a child-class' constructor differs from the parent, only the difference needs to be specified, highlighting the difference in the configuration.

I don't know if these changes fit within the vision of the library (or indeed if the actual changes are good enough) but I thought I'd put up a PR with the suggestion anyway.

One thing I'm not sure of is whether it's better to have the inheritance happen at make()-time or define()-time, but figured make()-time gives a little extra flexibility despite the increased cost.

Again, thanks for the library - looking forward to your thoughts.