| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function testFixDictionaryIndex() |
||
| 30 | { |
||
| 31 | $dict = $this->buildMock(); |
||
| 32 | |||
| 33 | $this->reflectionSet($dict, 'dictionary', [ |
||
| 34 | 'foo' => 21, |
||
| 35 | 'bar' => 42, |
||
| 36 | ]); |
||
| 37 | $this->reflectionCall($dict, 'fixDictionaryIndex'); |
||
| 38 | |||
| 39 | $dictAr = $this->reflectionGet($dict, 'dictionary'); |
||
| 40 | $this->assertEqualArray($dictAr, [ |
||
| 41 | 'foo' => [ |
||
| 42 | 'code' => 'foo', |
||
| 43 | 'title' => 21, |
||
| 44 | ], |
||
| 45 | 'bar' => [ |
||
| 46 | 'code' => 'bar', |
||
| 47 | 'title' => 42, |
||
| 48 | ], |
||
| 49 | ]); |
||
| 50 | } |
||
| 51 | |||
| 67 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: