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 |
||
| 12 | class Cv extends AbstractRepository |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Look for an drafted Document of a given user |
||
| 16 | * |
||
| 17 | * @param $user |
||
| 18 | * @return \Cv\Entity\Cv|null |
||
|
|
|||
| 19 | */ |
||
| 20 | View Code Duplication | public function findDraft($user) |
|
| 39 | } |
||
| 40 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.