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