I don't know how Zend works, but regardless of the framework, hiding the dependencies locks our code to the DI container, obfuscate the code, makes the design opaque and oriented to magic. In general, makes our project harder to understand.
Parameterized constructors and setters make our code less oriented to magic and less prone to Poltergeist. Some containers allow us to drop these wonders from the code, but why should we?1
Regarding the ServiceLocator as alternative
For RAD, when Controllers ask for a lot of dependencies, when business logic is complex enough, instead of cluttering Controller constructor methods with 5+ dependencies, it is at times more convenient to pass the Service Locator / container as the dependency to the Controller and let code inside the Controller invoke various many objects via SL/DiC facilities.
I disagree for the next reasons:
ServiceLocator is still hiding the dependencies and it doesn't make the testing easier either. Quite the opposite.
If the controllers have so many dependencies, don't they have too many responsibilities as well? Is then ServiceLocator hiding my design weakness or just contributing to them?
it is at times more convenient to pass the Service Locator/container as the dependency.Where did the supposed abstraction go?
let code inside the Controller invoke various many objects via SL/DiC facilities.Where did IoC go?
Where did the supposed abstraction go?
let code inside the Controller invoke various many objects via SL/DiC facilities.Where did IoC go?
What is the container doing for us? If we use the container here and there, where is the consistency?
In Java, Spring does the very same magic, but it doesn't prevent me from implementing constructors and setters and enforce the framework to use them all. My reasoning is that the more I fall into the Spring facilities the more I lock my developments to the framework. Ultimately, I'm not a Spring senior engineer.
Summarising, don't hide your dependencies. Make them obvious and obvious will be your designs and don't lock yourself to a specific tool.
1: This is the sweet we should avoid. It generates a "personal" technical debt that eventually reverts against you.