Dependency injection: At what point am I allowed to create a new object?
- by Gaz_Edge
I am refactoring a PHP application, and I am trying to do has much dependency injection (DI) as possible.
I feel like I've got a good grasp of how it works, and I can certainly see my classes becoming a lot leaner and more robust.
I'm refactoring so that I can inject a dependency rather than create a new object within the class, but at some point…