| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 1.3847 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function register(): void |
||
| 18 | { |
||
| 19 | 83 | $this->app->singleton(ChannelManager::class, function () { |
|
| 20 | /** @var array $channels */ |
||
| 21 | $channels = collect($this->config()) |
||
| 22 | ->mapWithKeys(function (array $parameters, string $name) { |
||
| 23 | return [$name => $parameters]; |
||
| 24 | }) |
||
| 25 | ->toArray(); |
||
| 26 | |||
| 27 | $manager = new ChannelManager($this->app); |
||
|
|
|||
| 28 | $manager->register($channels); |
||
| 29 | |||
| 30 | return $manager; |
||
| 31 | 83 | }); |
|
| 32 | 83 | } |
|
| 33 | |||
| 42 |
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.