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 |
||
21 | class VcsSubscriber implements EventSubscriberInterface |
||
22 | { |
||
23 | protected $io; |
||
|
|||
24 | |||
25 | 1 | public function __construct(IOInterface $io) |
|
29 | |||
30 | 1 | public static function getSubscribedEvents() |
|
37 | |||
38 | View Code Duplication | public function onVcsPreCheckout(VcsEvent $event) |
|
54 | |||
55 | View Code Duplication | public function onVcsPreExport(VcsEvent $event) |
|
71 | } |
||
72 |
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.