>
> That basically means a simple closure would do the job equally well, isn't?
>

Yes, for such a basic use-case like mine, a Clousure would be also 
sufficient but type-hinting would be sacrified when doing so (I mean it is 
more difficult to document the Closure's signature).

Furthermore, if a container offers different methods for fetching Singleton 
and Prototype entries then it is not obvious which method to use in the 
Clousure (controllers should be Singletons for sure, but let's generalize 
the problem further than the dispatcher example). Via a common interface 
like ContainerInterface which defines a single method for fetching, objects 
can be consumed regardless if they are Singleton or Prototype: consumers 
only have to trust the developer if configuration is appropriate.

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/94db3225-b44b-4076-be15-f437d100cbb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to