Yes the point is that many containers have optional extra parameters, but ContainerInterface is still compatible with them so all is fine (i.e. there is no incompatibility).
So just to get this straight: we remove the sentence (because it sounds weird to have it in a standard), but we agree that it's still completely fine if implementations have extra *optional* parameters right? Because we obviously want to keep all containers compatible. If so, I'm +1 to remove the sentence (I just don't want to force implementations to have exactly 1 parameter, which doesn't make sense in PHP and in OOP in general). Matthieu Le mercredi 2 novembre 2016 18:57:00 UTC+1, David Négrier a écrit : > > This is a followup to Larry's message here: > https://groups.google.com/d/msg/php-fig/L8rDUwRFsOU/AmNE1PlFBgAJ > > The spec says: > > *While ContainerInterface only defines one mandatory parameter in get(), > implementations MAY accept additional optional parameters.* > > Larry says: > > > ** The allowance for additional parameters on get() is worrisome. That > implies ANY use of a second or further parameter sets me up for an > incompatibility, but implementations are free to add those > implementation-specific hooks that I can couple to. I would much prefer to > omit that allowance entirely. (Technically optional parameters cannot be > prevented, but we shouldn't encourage it.) * > > When we first released container-interop, we wrote this to tell it was ok > to add support for ContainerInterface to already existing containers that > did accept more than one parameter for the "get" method (for instance: > http://api.symfony.com/2.3/Symfony/Component/DependencyInjection/ContainerInterface.html > ) > > Yet, I do agree with Larry. This does not belong to a PSR. Maybe we can > simply add a comment about this in the META doc and completely get rid of > this sentence. > > I'm +1 to remove the whole sentence. > Anyone has any objection? If not, I'll write a PR. > > ++ > David. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/0121ad52-d6a4-4c9c-9c14-61f0c7839124%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
