Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 1 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function register() |
||
18 | { |
||
19 | 3 | $this->getContainer()->share(Clickhouse::class, function () { |
|
20 | 2 | return new Clickhouse($this->getContainer()); |
|
|
|||
21 | 3 | }); |
|
22 | |||
23 | 3 | $this->getContainer()->share(Client::class, function () { |
|
24 | 3 | $serviceName = $this->getContainer()->get(Service::class)->getName(); |
|
25 | 3 | $config = $this->getContainer()->get(Config::class)['clickhouse']; |
|
26 | |||
27 | 3 | $clickhouse = new Client($config); |
|
28 | 3 | $clickhouse->write('create database if not exists '.$serviceName); |
|
29 | 3 | $clickhouse->database($serviceName); |
|
30 | |||
31 | 3 | return $clickhouse; |
|
32 | 3 | }); |
|
33 | 3 | } |
|
34 | } |
||
35 |
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.