1 | <?php |
||
12 | class Task extends Model |
||
13 | { |
||
14 | use IsRecordable, HasPriority; |
||
15 | |||
16 | protected $table = 'tasks'; |
||
17 | |||
18 | public $primaryKey = 'id'; |
||
19 | |||
20 | public $guarded = ['id']; |
||
21 | |||
22 | public $timestamps = true; |
||
23 | |||
24 | protected $casts = [ |
||
25 | 'complete' => 'bool', |
||
26 | 'deduct_hours' => 'integer', |
||
27 | ]; |
||
28 | |||
29 | public function creator() : BelongsTo |
||
33 | |||
34 | public function priority() : BelongsTo |
||
38 | |||
39 | public function projects() : MorphToMany |
||
43 | |||
44 | public function records() : MorphMany |
||
48 | |||
49 | public function assignToProject(Project $project) : void |
||
55 | |||
56 | public function markCompletion(bool $bool) : void |
||
60 | |||
61 | public function completed() : bool |
||
65 | |||
66 | public function recordTime($from, $to) : void |
||
75 | |||
76 | public function removeRecord(Record $record) : void |
||
84 | |||
85 | public function deductHours($time) : void |
||
94 | |||
95 | public function addHours($time) : void |
||
104 | } |
||
105 |
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.