Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
38 | function setAsyncScheduler(LoopInterface $loop): void |
||
39 | { |
||
40 | try { |
||
41 | Scheduler::setAsyncFactory(function () use ($loop) { |
||
42 | 1 | return new Scheduler\EventLoopScheduler($loop); |
|
|
|||
43 | 1 | }); |
|
44 | 1 | } catch (Exception $e) { |
|
45 | 1 | if ($e->getMessage() === 'The async factory can not be set after the scheduler has been created') { |
|
46 | 1 | return; |
|
47 | } |
||
48 | |||
49 | throw $e; |
||
50 | } |
||
51 | } |
||
52 |
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: