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 |
||
| 19 | class TaskRunnerSubscriber implements EventSubscriberInterface |
||
| 20 | { |
||
| 21 | protected $io; |
||
|
|
|||
| 22 | protected $showProgress = false; |
||
| 23 | protected $needsNewline = false; |
||
| 24 | |||
| 25 | 1 | public function __construct(IOInterface $io) |
|
| 29 | |||
| 30 | 1 | public static function getSubscribedEvents() |
|
| 37 | |||
| 38 | View Code Duplication | public function onTaskPreExecute(GenericEvent $event) |
|
| 66 | |||
| 67 | public function onTaskPostExecute(GenericEvent $event) |
||
| 75 | } |
||
| 76 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.