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] Throw useful exception on bad XML argument tags#22527
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
nicolas-grekas commentedApr 26, 2017
Needs#22529 to be green. |
| switch ($arg->getAttribute('type')) { | ||
| case'service': | ||
| if (!$arg->getAttribute('id')) { |
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.
hasAttribute?
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.
An empty attribute is also invalid, so better as is IMHO
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.
Ok 👍
| break; | ||
| case'closure-proxy': | ||
| if (!$arg->getAttribute('id')) { | ||
| thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="service" is missing an "id" attribute in "%s".',$name,$file)); |
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.
wrong type
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.
fixed thanks
| thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="service" is missing an "id" attribute in "%s".',$name,$file)); | ||
| } | ||
| if (!$arg->getAttribute('method')) { | ||
| thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="service" is missing a "method" attribute in "%s".',$name,$file)); |
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.
wrong type
ae21520 tocdc24baComparenicolas-grekas commentedApr 26, 2017
rebased |
| switch ($arg->getAttribute('type')) { | ||
| case'service': | ||
| if (!$arg->getAttribute('id')) { |
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.
Ok 👍
| switch ($arg->getAttribute('type')) { | ||
| case'service': | ||
| if (!$arg->getAttribute('id')) { | ||
| thrownewInvalidArgumentException(sprintf('Tag "<%s>" with type="service" is missing an "id" attribute in "%s".',$name,$file)); |
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.
is missing or is empty?
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.
fixed
fabpot commentedApr 29, 2017
Thank you@nicolas-grekas. |
…nicolas-grekas)This PR was merged into the 3.3-dev branch.Discussion----------[DI] Throw useful exception on bad XML argument tags| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#22525| License | MIT| Doc PR | -I still think that the feature request in#22525 would make things better.But at least, let's make thing fail loudly, instead of silently today, with the associated usual wtfs :)Commits-------91828ec [DI] Throw useful exception on bad XML argument tags
I still think that the feature request in#22525 would make things better.
But at least, let's make thing fail loudly, instead of silently today, with the associated usual wtfs :)