Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 1 | private function buildMessage(Unbound $e, array $msg) |
|
31 | { |
||
32 | 1 | while ($e instanceof Unbound) { |
|
33 | 1 | $msg[] = sprintf("- %s\n", $e->getMessage()); |
|
34 | 1 | $lastE = $e; |
|
35 | 1 | $e = $e->getPrevious(); |
|
36 | 1 | } |
|
37 | 1 | array_pop($msg); |
|
38 | 1 | $msg = array_reverse($msg); |
|
39 | |||
40 | 1 | return $this->getMainMessage($lastE) . implode('', $msg); |
|
41 | } |
||
42 | |||
52 |
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.