-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Reduce complexity of autowiring #22256
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
Conversation
// no default value? Then fail | ||
if (!$parameter->isOptional()) { | ||
if (!$parameter->isDefaultValueAvailable()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as spotted here: #22254 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@nicolas-grekas I let you merge this one |
This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Reduce complexity of autowiring | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no (tweaking existing ones) | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - - optional args are autowired - methods with only optional args are autowired - default values of required args when possible Both first changes remove the behavior delta between constructors and setters, and is expected to me now that things are more explicit. This reduces the "know-how" requirements for using autowiring and is easier to get correct intuitively. The 3rd change plays nice with named args. Commits ------- 146f074 [DI] Reduce complexity of autowiring
Both first changes remove the behavior delta between constructors and setters, and is expected to me now that things are more explicit. This reduces the "know-how" requirements for using autowiring and is easier to get correct intuitively. The 3rd change plays nice with named args.