Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] Support attribute autoconfiguration on static methods/properties #47060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alex-dev opened this issue Jul 25, 2022 · 0 comments

Comments

@alex-dev
Copy link
Contributor

Description

A static method can be used to carry complex configuration payload for DI.
A static method can be used to generate a Closure that can be hooked in the container (a static message handler with no dependency).
Not checking static method disallow using simple attribute autoconfigurator to wire those case easily.

Example

class A {
  #[SomeAttribute]
  public static function config(): mixed {}
}
nicolas-grekas added a commit that referenced this issue Jan 26, 2023
…n on static methods (alex-dev)

This PR was squashed before being merged into the 6.3 branch.

Discussion
----------

[DependencyInjection] Allow attribute autoconfiguration on static methods

| Q                | A
| ------------ | ---
| Branch?      | 6.2
| Bug fix?      | no
| Tickets       | #47060
| License       | MIT

A static method can be used to carry complex configuration payload for DI.
A static method can be used to generate a Closure that can be hooked in the container (a static message handler with no dependency).
Using simple attribute autoconfigurator to wire those case easily.

Commits
-------

9908415 [DependencyInjection] Allow attribute autoconfiguration on static methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants