Closed
Description
A service may be declared as final. In that situation, when the service is registered as lazy to Symfony DIC, it will throw an exception:
[ProxyManager\Exception\InvalidProxiedClassException] Provided class "Foo" is final and cannot be proxied
Where actually it can be proxied: you just need to proxy the parent class or the implemented interface instead like done in Zend\ServiceManager. I'm not sure how you are supposed to do however when your class extend another one and/or implements one or several interfaces. But the alternatives are:
- Create a non-final decorator and use it instead
- Remove the
final
keyword (not always doable)
TBH I think those two alternative solutions kind of sucks as I don't think the usage of a DIC should influence how you design you services.
Thoughts?