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