-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Do not process bindings in AbstractRecursivePass #24602
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
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #24559 |
License | MIT |
Doc PR | n/a |
Build failure unrelated. |
Does this mean that in the example mentioned in #24559 the inlined |
@dmaicher yes |
👍 Should it not be merged into 3.4 instead of master? |
79c4875
to
98cb64f
Compare
Are you sure about it ? Bindings are used by the autowiring layer, which runs before the removal passes. If the autowiring has not used the binding to set a reference, we don't have a usage (and we don't need to prevent removal AFAIK). And if the binding was used to fill an argument, we will have a reference in the arguments (and so processed by the existing code) |
@stof if the service was inlined this it not true I believe. It will have an inlined |
@dmaicher and this is fine as well, as the argument is still filled properly. It does not need the binding anymore. Actually, I think the issue is that AbstractRecursivePass is always processing bindings in the exact same way it processes arguments, method calls and so on. |
@stof ok I see 😉 Then we should indeed not check the References contained in bindings I guess. So the Definitions can be removed correctly for inlined services. |
98cb64f
to
d86f126
Compare
72ffcb1
to
b175419
Compare
PR updated to not process bindings in AbstractRecursivePass. |
@@ -67,7 +67,6 @@ protected function processValue($value, $isRoot = false) | |||
$value->setArguments($this->processValue($value->getArguments())); | |||
$value->setProperties($this->processValue($value->getProperties())); | |||
$value->setMethodCalls($this->processValue($value->getMethodCalls())); | |||
$value->setBindings($this->processValue($value->getBindings())); |
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.
can we have a test case for this? for example within the RemoveUnusedDefinitionsPassTest
?
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.
Sorry I mean the test for the pass that checks if services exist ;p
==> CheckExceptionOnInvalidReferenceBehaviorPassTest
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.
Test added
6b2282f
to
148bdec
Compare
{ | ||
$container = new ContainerBuilder(); | ||
|
||
$container->register('a', 'stdClass'); |
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.
this test will now also pass without your change I believe? we should remove this line so the Reference a
in the bindings does actually not exist on the container?
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.
oops :) fixed
148bdec
to
6a6256c
Compare
Thank you @chalasr. |
…lasr) This PR was merged into the 3.4 branch. Discussion ---------- [DI] Do not process bindings in AbstractRecursivePass | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24559 | License | MIT | Doc PR | n/a Commits ------- 6a6256c Do not process bindings in AbstractRecursivePass
This PR was merged into the 3.4 branch. Discussion ---------- [DI] Fix cannot bind env var | Q | A | ------------- | --- | Branch? | 3.4 <!-- see comment below --> | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #24845 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A In #24602 we removed the processing of bindings from the `AbstractRecursivePass`. But there is actually one case where we want a recursive pass to process them: to resolve env param placeholders. Commits ------- f8f3a15 [DI] Fix cannot bind env var