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 |
||
| 11 | class ProcessExecutor implements ConfigAwareInterface, LoggerAwareInterface, OutputAwareInterface, VerbosityThresholdInterface |
||
| 12 | { |
||
| 13 | use ExecTrait; |
||
| 14 | use TaskIO; // uses LoggerAwareTrait and ConfigAwareTrait |
||
| 15 | use ProgressIndicatorAwareTrait; |
||
| 16 | use OutputAwareTrait; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param Process $process |
||
| 20 | * @return type |
||
|
|
|||
| 21 | */ |
||
| 22 | public function __construct(Process $process) |
||
| 26 | |||
| 27 | View Code Duplication | public static function create($container) |
|
| 38 | |||
| 39 | /** |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | protected function getCommandDescription() |
||
| 46 | |||
| 47 | public function run() |
||
| 51 | } |
||
| 52 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.