1 | <?php declare(strict_types=1); |
||
24 | class ScalarFactory implements Factory |
||
25 | { |
||
26 | const PRIORITY = 900; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected static $primitiveMap = [ |
||
32 | Schema::TYPE_STRING => StringProcessor::class, |
||
33 | Schema::TYPE_INT => IntegerProcessor::class, |
||
34 | Schema::TYPE_BOOL => BoolProcessor::class, |
||
35 | Schema::TYPE_NUMBER => NumberProcessor::class, |
||
36 | Schema::TYPE_NULL => NullProcessor::class, |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * @param Schema $schema |
||
41 | * @param ProcessorBuilder $builder |
||
42 | * @return Processor|null |
||
43 | */ |
||
44 | public function create(Schema $schema, ProcessorBuilder $builder) |
||
57 | |||
58 | /** |
||
59 | * @return int |
||
60 | */ |
||
61 | public function getPriority(): int |
||
65 | } |
||
66 |
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.