-
Notifications
You must be signed in to change notification settings - Fork 18
Make args array contain an argument for every parameter of the method. #27
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
Currently if the received params object does not contain a certain parameter of the function this parameter is simply omitted in the array, resulting in a displacement of the following arguments. This commit fills a missing parameter in the array by the value `null` so that at least all parameters are represented in the args array.
Could you add a test for this? |
Codecov Report
@@ Coverage Diff @@
## master #27 +/- ##
============================================
+ Coverage 89.6% 89.65% +0.05%
+ Complexity 58 57 -1
============================================
Files 8 8
Lines 125 116 -9
============================================
- Hits 112 104 -8
+ Misses 13 12 -1
|
You mean a test that shows that the current situation has problems? This change should be covered by the current tests, specifically the |
Yes, a test that fails on master, while it passes on this branch. This helps prevent regressions. |
I added a test, note that it does cheat a little bit. I originally had the assert line as follows $this->assertEquals($this->calls, [new MethodCall('someMethodWithDifferentlyTypedArgs', ['arg2' => 0])]); Which fails on master, but also on my fix because it passes the arguments in a different way. I do not know how to fix this issue without changing the way that arguments are passed to the method. Maybe you have a better idea. |
tests/DispatcherTest.php
Outdated
@@ -50,6 +50,13 @@ public function testCallMethodWithArrayParamTag() | |||
$this->assertEquals($this->calls, [new MethodCall('someMethodWithArrayParamTag', [[new Argument('whatever')]])]); | |||
} | |||
|
|||
public function testCallMethodWithDifferentlyTypedArgs() |
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 think a more descriptive name of this test would be testCallMethodWithMissingArgument
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.
Adapted
I think it is totally fine to pass |
Released in 3.0.2 |
Currently if the received params object does not contain a certain parameter of the function
this parameter is simply omitted in the array, resulting in a displacement of the following
arguments.
This commit fills a missing parameter in the array by the value
null
so that at least allparameters are represented in the args array.