Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DI] Fix autowire error for inlined services#22857
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| newRemoveUnusedDefinitionsPass(), | ||
| )), | ||
| newAutowireExceptionPass($autowirePass), | ||
| newAutowireExceptionPass($autowirePass,$inlinedServicePass), |
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.
perhaps pass$inlinedServicePass->getInlinedServiceIds() directly?
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.
I'd love to, but the passes haven't run yet at this point
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.
the pass did not run yet so this would just return an empty array
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.
aargh.. right :)
| * Returns an array of all services inlined by this pass. | ||
| * | ||
| * @return array Service id strings | ||
| */ |
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.
@internal?
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.
I don't think so
nicolas-grekas left a 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.
👍 (after fabbot fix)
3020bde toaeb38f6Comparenicolas-grekas commentedMay 23, 2017
Thank you@weaverryan. |
This PR was squashed before being merged into the 3.3 branch (closes#22857).Discussion----------[DI] Fix autowire error for inlined services| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#22848| License | MIT| Doc PR | n/aThe `AutowirePass` defers autowiring exceptions until later so that we don't throw autowiring exceptions for services that are ultimately removed. But, if a service is *inlined*, then it appears to be removed, and so we don't throw the exception. This fixes that.It's an easy fix - but it's a bit ugly. We're adding a bit more "state" to the passes... simply because there is some information that needs to be shared through the compiler process. There might be a better way of doing this in the future (e.g. storing some metadata on the `Compiler`), but this *does* work well.Commits-------4bcef3d [DI] Fix autowire error for inlined services
The
AutowirePassdefers autowiring exceptions until later so that we don't throw autowiring exceptions for services that are ultimately removed. But, if a service isinlined, then it appears to be removed, and so we don't throw the exception. This fixes that.It's an easy fix - but it's a bit ugly. We're adding a bit more "state" to the passes... simply because there is some information that needs to be shared through the compiler process. There might be a better way of doing this in the future (e.g. storing some metadata on the
Compiler), but thisdoes work well.