Check arguments in assertContainerBuilderHasServiceDefinitionWithMehodCall only if they were provided #75
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.
Hello,
I was writing some compiler passes and noticed a little inconsistency - a lot of the
assertContainerBuilderHas*
methods have optional parameters, which is great, because you can choose the level of detail you want to check. This is especially needed if you are using a compiler pass to augment 3rd party code, where you don't have absolute control over it.So for example
assertContainerBuilderHasServiceDefinitionWithArgument
takes argument value as a option and checks it only when given.On the other hand
assertContainerBuilderHasServiceDefinitionWithMehodCall
has optionalarguments
parameter, but if you don't specify the argument, then the default is[]
which means check that there are no arguments, which is totally different and could be confusing given the wording of the message (I gothas a method call to "setLogger" with the given arguments..
).So I believe there is a need to differentiate no arguments given to check and check that there are no arguments, which I think can be translated as
null
vs[]
and it would be understandable and even BC compatible, because if someone wants to check to empty array, they really should specify an empty array.I think there may be other methods which accept arrays and behave similarly to the current state (
assertContainerBuilderHasServiceDefinitionWithTag
?), so If you will agree on this one with me and want me to, I can have a look at them too.