Skip to content

[DependencyInjection] [Autowiring] Allow undefined nullable parameters (6.3) #50023

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
wants to merge 2 commits into from
Closed

Conversation

radar3301
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? yes
New feature? yes
Deprecations? no
Tickets Fix #50020
License MIT
Related PR #50022

Allows autowiring of undefined nullable parameters, similar to existing behavior for non-parameter values. See related issue for more detail.

@radar3301 radar3301 requested a review from dunglas as a code owner April 14, 2023 20:33
@carsonbot carsonbot added this to the 6.3 milestone Apr 14, 2023
@carsonbot carsonbot changed the title [DI][Autowiring] Allow undefined nullable parameters (6.3) [DependencyInjection] [Autowiring] Allow undefined nullable parameters (6.3) Apr 14, 2023
@radar3301 radar3301 closed this Apr 14, 2023
@radar3301 radar3301 deleted the patch-2 branch April 14, 2023 20:55
@radar3301 radar3301 restored the patch-2 branch April 14, 2023 20:58
@radar3301
Copy link
Contributor Author

Grr... Tried renaming local patch to https://github.com/radar3301/symfony/tree/autowire-undefined-nullable-6.3

@radar3301 radar3301 reopened this Apr 14, 2023
@nicolas-grekas
Copy link
Member

Thanks for the PRs. Usually we ask for the patch on the lowest affected branch, and we merge up periodically. When the merge generates conflicts, we fix the conflict and we sometimes ask the author for their help if it's non trivial. I'm therefor closing this PR but it'll definitely help when merging #50022, if accepted!

@radar3301
Copy link
Contributor Author

radar3301 commented Apr 16, 2023

Thanks for the feedback Nicolas.


The Autowire Attribute was added in 6.1, and handling of the Autowire attribute was added directly to autowireMethod.
6.2 added a processAttribute method to do the actual processing, and rewrote autowireMethod to handle the attribute.
Then 6.3 removed processAttribute and moved the attribute handling back into autowireMethod.

It's all a big mess, hence the 3 different patches I created.

Hope this brief overview helps when then time comes!

nicolas-grekas added a commit that referenced this pull request Apr 19, 2023
…iring undefined parameters for optional arguments (radar3301)

This PR was merged into the 6.2 branch.

Discussion
----------

[DependencyInjection] Fallback to default value when autowiring undefined parameters for optional arguments

| Q             | A
| ------------- | ---
| Branch?       | 6.2 / 6.3
| Bug fix?      | yes
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #50020 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT
| Related       | PR #50023

Allows autowiring of undefined nullable parameters, similar to existing behavior for non-parameter values. See related issue for more detail.

Commits
-------

2d9bc8c [DependencyInjection] Fallback to default value when autowiring undefined parameters for optional arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dependency Injection Autowiring throws exception for nullable parameters that don't exist
3 participants