Skip to content

Commit

Permalink
Remove unneeded and undocumented loop argument for stream listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Oct 13, 2017
1 parent 7c7aae9 commit 8997565
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ExtEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/LibEvLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/LibEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ 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);
}
}

foreach ($write as $stream) {
$key = (int) $stream;

if (isset($this->writeListeners[$key])) {
call_user_func($this->writeListeners[$key], $stream, $this);
call_user_func($this->writeListeners[$key], $stream);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/StreamSelectLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 comment has been minimized.

Copy link
@kelunik

kelunik Oct 15, 2017

Contributor

That breaks PHP 5.3 compat, right?

This comment has been minimized.

Copy link
@clue

clue Oct 15, 2017

Author Member

This PR is targeted for the v0.5.0 release, PHP 5.3 support has already been dropped with the v0.4.0 release.

}
});
$this->loop->addTimer(0.05, function() use ($writeStream) {
Expand Down

0 comments on commit 8997565

Please sign in to comment.