| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function register(): void |
||
| 17 | { |
||
| 18 | $this->app->singleton(ChannelManager::class, function () { |
||
| 19 | return tap(new ChannelManager($this->app), function (ChannelManager $manager) { |
||
|
|
|||
| 20 | /** @var array $channels */ |
||
| 21 | $channels = collect(config('fondbot.channels')) |
||
| 22 | ->mapWithKeys(function (array $parameters, string $name) { |
||
| 23 | return [$name => $parameters]; |
||
| 24 | }) |
||
| 25 | ->toArray(); |
||
| 26 | |||
| 27 | $manager->register($channels); |
||
| 28 | }); |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.