Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
41 | 21 | protected function doDecorate($mock, Stub $stub) |
|
42 | { |
||
43 | 21 | $methodName = $stub->getMethodName(); |
|
44 | 21 | $methodValue = $stub->getMethodValue(); |
|
45 | |||
46 | /** @var AnswerBinderProxy $partial */ |
||
47 | 21 | $partial = Phake::when($mock)->$methodName(new FirstStubMatcher($mock, $methodName)); |
|
48 | 21 | $methodValue instanceof \Throwable |
|
49 | 21 | ? $partial->thenThrow($methodValue) |
|
1 ignored issue
–
show
|
|||
50 | 21 | : $partial->thenReturn($methodValue); |
|
51 | } |
||
52 | |||
62 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.