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 |
||
| 7 | class RewriteHtaccessFile extends AbstractSubCommand |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @return bool |
||
|
|
|||
| 11 | */ |
||
| 12 | public function execute() |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $baseUrl |
||
| 46 | */ |
||
| 47 | protected function replaceHtaccessFile($baseUrl) |
||
| 58 | |||
| 59 | protected function _backupOriginalFile($htaccesFile) |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param string $htaccessFile |
||
| 69 | * @param string $baseUrl |
||
| 70 | */ |
||
| 71 | protected function _replaceContent($htaccessFile, $baseUrl) |
||
| 77 | } |
||
| 78 |
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.