laminas / laminas-servicemanager

Factory-Driven Dependency Injection Container
https://docs.laminas.dev/laminas-servicemanager/
BSD 3-Clause "New" or "Revised" License
150 stars 56 forks source link

Conflict in doc and implementation #23

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

The documentation states that a factory stored in a class would implement FactoryInterface but it doesn't reference which one. In ZF3 there still exists the ZF2 FactoryInterface which requires a 'createService' method while the ZF3 interface requires '__invoke'.

It is confusing to still have the ZF2 implementation out there when the clear direction in the docs in ZF3. Perhaps it should be removed?


Originally posted by @robob4him at https://github.com/zendframework/zend-servicemanager/issues/144

weierophinney commented 4 years ago

@robob4him Can you link to a specific page and heading where you see this occurring, please?


Originally posted by @weierophinney at https://github.com/zendframework/zend-servicemanager/issues/144#issuecomment-244191804

weierophinney commented 4 years ago

@weierophinney, np.

https://zendframework.github.io/zend-servicemanager/configuring-the-service-manager/ It's the example after the text:

Alternatively, the above code can be replaced by a factory class instead of a closure. This leads to more readable code. For instance:


Originally posted by @robob4him at https://github.com/zendframework/zend-servicemanager/issues/144#issuecomment-244245303

weierophinney commented 4 years ago

Uhm, thats all right by the way. There is no specific namespace given and since the new FactoryInterface is located under Zend\ServiceManager\Factory\FactoryInterface, there is no requirement for implementing the old Zend\ServiceManager\FactoryInterface which defined the createService method.

But yes, the lack of the use statement in the top of the snippet might lead to the wrong Interface tho.


Originally posted by @boesing at https://github.com/zendframework/zend-servicemanager/issues/144#issuecomment-302752930