Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 8 | class LoadSnapshotCommand extends Command |
||
| 9 | { |
||
| 10 | protected $signature = 'event-projector:load-snapshot'; |
||
| 11 | |||
| 12 | protected $description = 'Load snapshots'; |
||
| 13 | |||
| 14 | /** @var \Spatie\EventProjector\Console\Snapshots\SnapshotRepository */ |
||
| 15 | protected $snapshotRepository; |
||
| 16 | |||
| 17 | public function __construct(SnapshotRepository $snapshotRepository) |
||
| 23 | |||
| 24 | View Code Duplication | public function handle() |
|
| 38 | } |
||
| 39 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..