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 |
||
8 | class ElfinderController extends AbstractActionController |
||
9 | { |
||
10 | |||
11 | protected $Config; |
||
12 | |||
13 | /** |
||
14 | * |
||
15 | * @var ServiceManager |
||
16 | */ |
||
17 | protected $serviceLocator; |
||
18 | |||
19 | public function __construct(ServiceLocatorInterface $locator) |
||
23 | |||
24 | public function getServiceLocator() |
||
29 | |||
30 | /** |
||
31 | * @return array|\Zend\View\Model\ViewModel |
||
32 | */ |
||
33 | View Code Duplication | public function indexAction() |
|
42 | |||
43 | /** |
||
44 | * @return \Zend\View\Model\ViewModel |
||
45 | */ |
||
46 | View Code Duplication | public function ckeditorAction() |
|
56 | |||
57 | /** |
||
58 | * @return \Zend\View\Model\ViewModel |
||
59 | */ |
||
60 | public function connectorAction() |
||
82 | |||
83 | /** |
||
84 | * @param $attr |
||
85 | * @param $path |
||
86 | * @param $data |
||
87 | * @param $volume |
||
88 | * |
||
89 | * @return bool|null |
||
90 | */ |
||
91 | public function access($attr, $path, $data, $volume) |
||
97 | |||
98 | /** |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public function getConfig() |
||
114 | } |
||
115 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..