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 |
||
| 13 | View Code Duplication | class VenueUpdate { |
|
| 14 | |||
| 15 | /** |
||
| 16 | * Defines the mutation data modification closure. |
||
| 17 | * |
||
| 18 | * @param EEM_Venue $model |
||
| 19 | * @param Venue $type |
||
| 20 | * @return callable |
||
| 21 | */ |
||
| 22 | public static function mutateFields(EEM_Venue $model, Venue $type) |
||
| 58 | } |
||
| 59 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.