Closed djmattyg007 closed 8 years ago
@djmattyg007 you are absolutely correct. The newInstance
cannot be used over https://github.com/auraphp/Aura.Di/blob/be6edc07eb3f2277b46b9a19bbe0978178366cee/docs/lazy.md#generic-lazy-calls .
I believe the second example could be removed or may be altered with new SomeObject
.
It would appear there is a bug in the documentation for the container's
lazy()
method: https://github.com/auraphp/Aura.Di/blame/77b6597fe58338578d975d6134b436ac24255f1a/docs/lazy.md#L145Here, an object is constructed using the container's
newInstance()
method, which locks the container. The following line attempts to define a new service in the container using theset()
method, which should immediately through an exception as the container has been locked.I would have submitted a PR for this, but I wasn't sure of the best way to provide the same example without this bug.