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] Display previous error messages when throwing unused bindings#27191
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
| thrownewInvalidArgumentException(sprintf('Unused binding "%s" in service "%s".',$key,$serviceId)); | ||
| $message =sprintf('Unused binding "%s" in service "%s".',$key,$serviceId); | ||
| if ($this->errors) { | ||
| $message .=sprintf("\nCould be related to%s:",1 <\count($errors) ?' one of' :''); |
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 should be$this->errors
| if ($this->errors) { | ||
| $message .=sprintf("\nCould be related to%s:",1 <\count($errors) ?' one of' :''); | ||
| } | ||
| foreach ($this->errorsas$serviceId =>$mesage) { |
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.
Not sure if the missings is voluntary here, but we can't use$message since it's used in the parent scope, maybe$error ?
| $message .=sprintf("\nCould be related to%s:",1 <\count($errors) ?' one of' :''); | ||
| } | ||
| foreach ($this->errorsas$serviceId =>$mesage) { | ||
| $message .=sprintf("\n -\"%s\": %s",$serviceId,$message); |
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 we need to put the service id here since it's already in the exception message thrown bygetConstructor.
nicolas-grekas commentedMay 8, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thank you@jvasseur, comments addressed. Do you confirm it fixes your issue? |
6d5d18a to40fe7cdCompare
jvasseur 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.
This works at solving the issue.
sroze commentedMay 9, 2018
@nicolas-grekas could you add a test for that? |
nicolas-grekas commentedMay 9, 2018
Test added. |
fabpot commentedMay 12, 2018
Thank you@nicolas-grekas. |
…bindings (nicolas-grekas)This PR was merged into the 3.4 branch.Discussion----------[DI] Display previous error messages when throwing unused bindings| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | n| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#27146| License | MIT| Doc PR | -As reported by@jvasseur, confirmation + review welcome.Commits-------f2231b5 [DI] Display previous error messages when throwing unused bindings
Uh oh!
There was an error while loading.Please reload this page.
As reported by@jvasseur, confirmation + review welcome.