| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 21 | public function expectInvalidArgumentExceptionGivenNonString($class_name, $data, $message = null) |
|
| 39 | { |
||
| 40 | 21 | if (!is_string($data)) { |
|
| 41 | 18 | $this->expectException(\InvalidArgumentException::class); |
|
| 42 | |||
| 43 | 18 | if (isset($message)) { |
|
| 44 | 18 | $this->expectExceptionMessage($message); |
|
| 45 | 18 | } |
|
| 46 | 18 | } |
|
| 47 | |||
| 48 | /** @noinspection PhpUnusedLocalVariableInspection */ |
||
| 49 | 21 | $non_string_instance = new $class_name($data); |
|
|
|
|||
| 50 | 3 | } |
|
| 51 | } |
||
| 52 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.