Skip to content

Commit bdf6581

Browse files
committed
Replace deprecated React\EventLoop\Factory::create()
Replace with `React\EventLoop\Loop::get()`. The single instance guard around the deprecated function call can be avoided now, because this is already done inside the new function.
1 parent 8fc9b01 commit bdf6581

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

application/clicommands/Command.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Icinga\Cli\Command as CliCommand;
1515
use Icinga\Module\Vspheredb\Configuration;
1616
use Icinga\Module\Vspheredb\Daemon\RemoteClient;
17-
use React\EventLoop\Factory as Loop;
17+
use React\EventLoop\Loop;
1818
use React\EventLoop\LoopInterface;
1919
use React\Stream\WritableResourceStream;
2020

@@ -39,11 +39,7 @@ public function init()
3939

4040
protected function loop()
4141
{
42-
if ($this->loop === null) {
43-
$this->loop = Loop::create();
44-
}
45-
46-
return $this->loop;
42+
return Loop::get();
4743
}
4844

4945
protected function eventuallyStartMainLoop()

application/controllers/AsyncControllerHelper.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
use Icinga\Module\Vspheredb\Configuration;
66
use Icinga\Module\Vspheredb\Daemon\RemoteClient;
7-
use React\EventLoop\Factory as Loop;
7+
use React\EventLoop\Loop;
88

99
use function React\Async\await;
1010
use function React\Promise\Timer\timeout;
1111

1212
trait AsyncControllerHelper
1313
{
14-
protected $loop;
15-
1614
/** @var RemoteClient */
1715
protected $remoteClient;
1816

@@ -35,11 +33,6 @@ protected function remoteClient()
3533

3634
protected function loop()
3735
{
38-
// Hint: we're not running this loop right now
39-
if ($this->loop === null) {
40-
$this->loop = Loop::create();
41-
}
42-
43-
return $this->loop;
36+
return Loop::get();
4437
}
4538
}

0 commit comments

Comments
 (0)