[DependencyInjection] Add iterable to possible binding type#44979
Merged
Conversation
Member
|
Please add a test case that covers the situation. |
Contributor
Author
|
Add test for this case |
Contributor
Author
|
@nicolas-grekas done |
|
|
||
| public function testIterableBindingTypehint() | ||
| { | ||
| spl_autoload_register( |
Member
There was a problem hiding this comment.
is this required? if not let's remove it
Contributor
Author
There was a problem hiding this comment.
it's required to show the problem, if this function will run it will mean that code of ResolveBindingsPass.php working incorrect
| $pass = new ResolveBindingsPass(); | ||
| $pass->process($container); | ||
|
|
||
| $this->assertInstanceOf( |
| ); | ||
|
|
||
| $container = new ContainerBuilder(); | ||
| $bindings = [ |
Member
There was a problem hiding this comment.
the variable could be removed
Member
|
Thank you @sveneld. |
nicolas-grekas
added a commit
that referenced
this pull request
Feb 16, 2022
This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead. Discussion ---------- [DependencyInjection] Fix type binding | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | License | MIT If $type is a scalar compiler pass should not check it in function is_subclass_of($type, \UnitEnum::class), because is_subclass_of trying to autoload class with name array, string, etc. Related to #44979 Commits ------- 3754018 Fix type binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When iterable type is set in binding like in example https://symfony.com/doc/current/service_container.html#binding-arguments-by-name-or-type, system tries to autoload class iterable here src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php:137