Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 2 | public function __invoke(array $options) |
|
17 | { |
||
18 | 2 | $handler = $this->getHandlerManager()->get($options['handler']); |
|
19 | 2 | $factor = (int) ($options['factor'] ?? null); |
|
20 | |||
21 | 2 | if (empty($factor)) { |
|
22 | 1 | throw new InvalidConfigException( |
|
23 | 1 | 'Factor is missing or is less then 1' |
|
24 | ); |
||
25 | } |
||
26 | |||
27 | 1 | return new SamplingHandler( |
|
28 | 1 | $handler, |
|
|
|||
29 | 1 | $factor |
|
30 | ); |
||
31 | } |
||
32 | } |
||
33 |
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: