1 | <?php |
||
11 | class Process |
||
12 | { |
||
13 | /** |
||
14 | * @var LoopInterface |
||
15 | */ |
||
16 | protected $loop; |
||
17 | |||
18 | /** |
||
19 | * @var Messenger |
||
20 | */ |
||
21 | protected $messenger; |
||
22 | |||
23 | /** |
||
24 | * @param LoopInterface $loop |
||
25 | * @param Messenger $messenger |
||
26 | * @return Process |
||
27 | */ |
||
28 | 2 | public static function create(LoopInterface $loop, Messenger $messenger) |
|
29 | { |
||
30 | try { |
||
31 | 2 | return new Process($loop, $messenger); |
|
32 | 1 | } catch (\Exception $exeption) { |
|
33 | 1 | $messenger->error(MessagesFactory::error([ |
|
34 | 1 | 'message' => $exeption->getMessage(), |
|
35 | 1 | 'code' => $exeption->getCode(), |
|
36 | 1 | 'line' => $exeption->getLine(), |
|
37 | 1 | 'file' => $exeption->getFile(), |
|
38 | 1 | ])); |
|
39 | $loop->addTimer(1, function () use ($loop) { |
||
|
|||
40 | 1 | $loop->stop(); |
|
41 | 1 | }); |
|
42 | } |
||
43 | |||
44 | 1 | } |
|
45 | |||
46 | /** |
||
47 | * Process constructor. |
||
48 | * @param LoopInterface $loop |
||
49 | * @param Messenger $messenger |
||
50 | */ |
||
51 | 2 | protected function __construct(LoopInterface $loop, Messenger $messenger) |
|
69 | |||
70 | /** |
||
71 | * @param string $className |
||
72 | */ |
||
73 | 1 | protected function registerClass($className) |
|
74 | { |
||
75 | 1 | call_user_func_array([ |
|
76 | 1 | $className, |
|
77 | 1 | 'create', |
|
78 | 1 | ], [ |
|
79 | 1 | $this->messenger, |
|
80 | 1 | $this->loop, |
|
81 | 1 | ]); |
|
82 | 1 | } |
|
83 | |||
84 | protected function deregisterRpc() |
||
90 | } |
||
91 |
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: