Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ProxyManager] Support final classes #20392

Copy link
Copy link
Closed
@theofidry

Description

@theofidry
Issue body actions

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.