Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | 2 | public function __toString() |
|
14 | { |
||
15 | 2 | $messages = [sprintf("- %s\n", $this->getMessage())]; |
|
16 | 2 | $e = $this->getPrevious(); |
|
17 | 2 | if (! $e instanceof \Exception) { |
|
18 | 1 | return $this->getMainMessage($this); |
|
19 | } |
||
20 | |||
21 | 1 | return $this->buildMessage($e, $messages) . "\n" . $e->getTraceAsString(); |
|
|
|||
22 | } |
||
23 | |||
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.