From 8997565319b8aceea8ae6300f3c0930bf0ed0fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 13 Oct 2017 12:29:05 +0200 Subject: [PATCH] Remove unneeded and undocumented loop argument for stream listeners --- src/ExtEventLoop.php | 4 ++-- src/LibEvLoop.php | 4 ++-- src/LibEventLoop.php | 4 ++-- src/StreamSelectLoop.php | 4 ++-- tests/StreamSelectLoopTest.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ExtEventLoop.php b/src/ExtEventLoop.php index e50b8777..0d088d50 100644 --- a/src/ExtEventLoop.php +++ b/src/ExtEventLoop.php @@ -289,11 +289,11 @@ private function createStreamCallback() $key = (int) $stream; if (Event::READ === (Event::READ & $flags) && isset($this->readListeners[$key])) { - call_user_func($this->readListeners[$key], $stream, $this); + call_user_func($this->readListeners[$key], $stream); } if (Event::WRITE === (Event::WRITE & $flags) && isset($this->writeListeners[$key])) { - call_user_func($this->writeListeners[$key], $stream, $this); + call_user_func($this->writeListeners[$key], $stream); } }; } diff --git a/src/LibEvLoop.php b/src/LibEvLoop.php index f6f0f490..3bbd8c4e 100644 --- a/src/LibEvLoop.php +++ b/src/LibEvLoop.php @@ -40,7 +40,7 @@ public function addReadStream($stream, callable $listener) } $callback = function () use ($stream, $listener) { - call_user_func($listener, $stream, $this); + call_user_func($listener, $stream); }; $event = new IOEvent($callback, $stream, IOEvent::READ); @@ -59,7 +59,7 @@ public function addWriteStream($stream, callable $listener) } $callback = function () use ($stream, $listener) { - call_user_func($listener, $stream, $this); + call_user_func($listener, $stream); }; $event = new IOEvent($callback, $stream, IOEvent::WRITE); diff --git a/src/LibEventLoop.php b/src/LibEventLoop.php index 4b252d45..ee648e7f 100644 --- a/src/LibEventLoop.php +++ b/src/LibEventLoop.php @@ -307,11 +307,11 @@ private function createStreamCallback() $key = (int) $stream; if (EV_READ === (EV_READ & $flags) && isset($this->readListeners[$key])) { - call_user_func($this->readListeners[$key], $stream, $this); + call_user_func($this->readListeners[$key], $stream); } if (EV_WRITE === (EV_WRITE & $flags) && isset($this->writeListeners[$key])) { - call_user_func($this->writeListeners[$key], $stream, $this); + call_user_func($this->writeListeners[$key], $stream); } }; } diff --git a/src/StreamSelectLoop.php b/src/StreamSelectLoop.php index 053948aa..085c7703 100644 --- a/src/StreamSelectLoop.php +++ b/src/StreamSelectLoop.php @@ -206,7 +206,7 @@ private function waitForStreamActivity($timeout) $key = (int) $stream; if (isset($this->readListeners[$key])) { - call_user_func($this->readListeners[$key], $stream, $this); + call_user_func($this->readListeners[$key], $stream); } } @@ -214,7 +214,7 @@ private function waitForStreamActivity($timeout) $key = (int) $stream; if (isset($this->writeListeners[$key])) { - call_user_func($this->writeListeners[$key], $stream, $this); + call_user_func($this->writeListeners[$key], $stream); } } } diff --git a/tests/StreamSelectLoopTest.php b/tests/StreamSelectLoopTest.php index d2e3e078..247070e2 100644 --- a/tests/StreamSelectLoopTest.php +++ b/tests/StreamSelectLoopTest.php @@ -90,11 +90,11 @@ public function testSignalInterruptWithStream($signal) // add stream to the loop list($writeStream, $readStream) = $this->createSocketPair(); - $this->loop->addReadStream($readStream, function($stream, $loop) { + $this->loop->addReadStream($readStream, function ($stream) { /** @var $loop LoopInterface */ $read = fgets($stream); if ($read === "end loop\n") { - $loop->stop(); + $this->loop->stop(); } }); $this->loop->addTimer(0.05, function() use ($writeStream) {