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 namespace Modules\Media\Providers; |
||
| 13 | class MediaServiceProvider extends ServiceProvider |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Indicates if loading of the provider is deferred. |
||
| 17 | * |
||
| 18 | * @var bool |
||
| 19 | */ |
||
| 20 | protected $defer = false; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Register the service provider. |
||
| 24 | * |
||
| 25 | * @return void |
||
| 26 | */ |
||
| 27 | public function register() |
||
| 34 | |||
| 35 | public function boot() |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the services provided by the provider. |
||
| 42 | * |
||
| 43 | * @return array |
||
| 44 | */ |
||
| 45 | public function provides() |
||
| 49 | |||
| 50 | private function registerBindings() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Register all commands for this module |
||
| 62 | */ |
||
| 63 | private function registerCommands() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Register the refresh thumbnails command |
||
| 70 | */ |
||
| 71 | private function registerRefreshCommand() |
||
| 84 | |||
| 85 | private function registerMaxFolderSizeValidator() |
||
| 91 | } |
||
| 92 |
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: