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 LaravelModulesServiceProvider extends ModulesServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Booting the package. |
||
12 | */ |
||
13 | 215 | public function boot() |
|
18 | |||
19 | /** |
||
20 | * Register the service provider. |
||
21 | */ |
||
22 | 215 | public function register() |
|
28 | |||
29 | /** |
||
30 | * Setup stub path. |
||
31 | */ |
||
32 | 215 | public function setupStubPath() |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 215 | View Code Duplication | protected function registerServices() |
63 | } |
||
64 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: