Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
12 | public static function create(): ListerInterface |
||
13 | 1 | { |
|
14 | 1 | $lister = null; |
|
|
|||
15 | foreach (self::LISTERS as $listerClass) { |
||
16 | 1 | /** @var ListerInterface $lister */ |
|
17 | 1 | $lister = new $listerClass(); |
|
18 | 1 | if ($lister->isSupported() === true) { |
|
19 | return $lister; |
||
20 | } |
||
21 | unset($lister); |
||
22 | } |
||
23 | |||
24 | throw NoCompatibleListerException::create(); |
||
25 | } |
||
26 | } |
||
27 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.