PHP8
[m6w6/seekat] / examples / amploop.php
index 5ecdd0dfe232d9d6ac4261b9a3d525b3b676d77a..1abbaa11e42d264dacaf4478607f1f6d49ea2bb2 100755 (executable)
@@ -84,12 +84,14 @@ $cli->configure([
                        $this->driver->setState((string) $socket, $id);
                        break;
                case self::POLL_INOUT:
-                       $id[] = $this->driver->onReadable($socket, function($id, $socket) {
-                               $this->run($socket, self::POLL_IN);
-                       });
-                       $id[] = $this->driver->onWritable($socket, function($id, $socket) {
-                               $this->run($socket, self::POLL_OUT);
-                       });
+                       $id = [
+                               $this->driver->onReadable($socket, function($id, $socket) {
+                                       $this->run($socket, self::POLL_IN);
+                               }),
+                               $this->driver->onWritable($socket, function($id, $socket) {
+                                       $this->run($socket, self::POLL_OUT);
+                               })
+                       ];
                        $this->driver->setState((string) $socket, $id);
                        break;
                case self::POLL_REMOVE:
@@ -110,4 +112,4 @@ AmpLoop::run(function() use($api) {
        list($m6w6, $seekat) = yield [$api->users->m6w6(), $api->repos->m6w6->seekat()];
        printf("Hi, my name is %s!\n", $m6w6->login);
        printf("Have fun with %s; %s!\n", $seekat->name, $seekat->description);
-});
\ No newline at end of file
+});