Skip to content

[DependencyInjection] Fix autowire attribute with nullable parameters #49379

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

alamirault
Copy link
Contributor

@alamirault alamirault commented Feb 14, 2023

Q A
Branch? 6.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #49370
License MIT
Doc PR N/A

This PR fix throwing exception Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly. when parameter is nullable with null value.

(sorry for pinging reviewers, switching branch trigger that)

@carsonbot
Copy link

Hey!

Oh no, it looks like you have made this PR towards a branch that is not maintained anymore. :/
Could you update the PR base branch to target one of these branches instead? 5.4, 6.2, 6.3.

Cheers!

Carsonbot

@alamirault alamirault force-pushed the hotfix/49370-autowire-attribute-with-nullable-parameters branch from aebfb5e to 82d35a6 Compare February 14, 2023 20:51
@alamirault alamirault changed the base branch from 6.1 to 6.2 February 14, 2023 20:52
@alamirault alamirault force-pushed the hotfix/49370-autowire-attribute-with-nullable-parameters branch from 82d35a6 to d1b8040 Compare February 14, 2023 20:53
@derrabus derrabus added the Bug label Feb 14, 2023
@derrabus
Copy link
Member

Wow, that was fast. Your fix looks correct. I'll test it on my codebase tomorrow to see if it fixes my issue there.

Can you please look into the "Coding Standard" failure reported by fabbot? The "Exception Messages Formatting" error however is a false positive and can be ignored.

@derrabus derrabus added this to the 6.2 milestone Feb 14, 2023
@nicolas-grekas nicolas-grekas force-pushed the hotfix/49370-autowire-attribute-with-nullable-parameters branch from 68f55ba to 75af866 Compare February 16, 2023 14:11
@nicolas-grekas
Copy link
Member

Thank you @alamirault.

@nicolas-grekas nicolas-grekas merged commit a4ef214 into symfony:6.2 Feb 16, 2023
@alamirault alamirault deleted the hotfix/49370-autowire-attribute-with-nullable-parameters branch February 16, 2023 15:22
@fabpot fabpot mentioned this pull request Feb 28, 2023
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.

4 participants