diff --git a/README.md b/README.md index 3aa0cc45..a8c300d1 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ $loop->addReadStream($server, function ($server) use ($loop) { $written = fwrite($conn, $data); if ($written === strlen($data)) { fclose($conn); - $loop->removeStream($conn); + $loop->removeWriteStream($conn); } else { $data = substr($data, $written); } @@ -394,14 +394,6 @@ remove the write event listener for the given stream. Removing a stream from the loop that has already been removed or trying to remove a stream that was never added or is invalid has no effect. -### removeStream() - -The `removeStream(resource $stream): void` method can be used to -remove all listeners for the given stream. - -Removing a stream from the loop that has already been removed or trying -to remove a stream that was never added or is invalid has no effect. - ## Install The recommended way to install this library is [through Composer](http://getcomposer.org). diff --git a/examples/21-http-server.php b/examples/21-http-server.php index 67423957..66180de1 100644 --- a/examples/21-http-server.php +++ b/examples/21-http-server.php @@ -14,7 +14,7 @@ $written = fwrite($conn, $data); if ($written === strlen($data)) { fclose($conn); - $loop->removeStream($conn); + $loop->removeWriteStream($conn); } else { $data = substr($data, $written); } diff --git a/src/ExtEventLoop.php b/src/ExtEventLoop.php index 0d088d50..1e246b16 100644 --- a/src/ExtEventLoop.php +++ b/src/ExtEventLoop.php @@ -88,10 +88,7 @@ public function removeWriteStream($stream) } } - /** - * {@inheritdoc} - */ - public function removeStream($stream) + private function removeStream($stream) { $key = (int) $stream; diff --git a/src/LibEvLoop.php b/src/LibEvLoop.php index 3bbd8c4e..8d03544b 100644 --- a/src/LibEvLoop.php +++ b/src/LibEvLoop.php @@ -94,15 +94,6 @@ public function removeWriteStream($stream) } } - /** - * {@inheritdoc} - */ - public function removeStream($stream) - { - $this->removeReadStream($stream); - $this->removeWriteStream($stream); - } - /** * {@inheritdoc} */ diff --git a/src/LibEventLoop.php b/src/LibEventLoop.php index ee648e7f..2ec0d1cc 100644 --- a/src/LibEventLoop.php +++ b/src/LibEventLoop.php @@ -89,10 +89,7 @@ public function removeWriteStream($stream) } } - /** - * {@inheritdoc} - */ - public function removeStream($stream) + private function removeStream($stream) { $key = (int) $stream; diff --git a/src/LoopInterface.php b/src/LoopInterface.php index a4d394c0..578567cf 100644 --- a/src/LoopInterface.php +++ b/src/LoopInterface.php @@ -120,16 +120,6 @@ public function removeReadStream($stream); */ public function removeWriteStream($stream); - /** - * Remove all listeners for the given stream. - * - * Removing a stream from the loop that has already been removed or trying - * to remove a stream that was never added or is invalid has no effect. - * - * @param resource $stream The PHP stream resource. - */ - public function removeStream($stream); - /** * Enqueue a callback to be invoked once after the given interval. * diff --git a/src/StreamSelectLoop.php b/src/StreamSelectLoop.php index 085c7703..fa5fae78 100644 --- a/src/StreamSelectLoop.php +++ b/src/StreamSelectLoop.php @@ -80,15 +80,6 @@ public function removeWriteStream($stream) ); } - /** - * {@inheritdoc} - */ - public function removeStream($stream) - { - $this->removeReadStream($stream); - $this->removeWriteStream($stream); - } - /** * {@inheritdoc} */ diff --git a/tests/AbstractLoopTest.php b/tests/AbstractLoopTest.php index 2470e555..832f3906 100644 --- a/tests/AbstractLoopTest.php +++ b/tests/AbstractLoopTest.php @@ -126,18 +126,6 @@ public function testRemoveWriteStreamAfterWriting() $this->tickLoop($this->loop); } - public function testRemoveStreamInstantly() - { - list ($input, $output) = $this->createSocketPair(); - - $this->loop->addReadStream($input, $this->expectCallableNever()); - $this->loop->addWriteStream($input, $this->expectCallableNever()); - $this->loop->removeStream($input); - - fwrite($output, "bar\n"); - $this->tickLoop($this->loop); - } - public function testRemoveStreamForReadOnly() { list ($input, $output) = $this->createSocketPair(); @@ -163,22 +151,6 @@ public function testRemoveStreamForWriteOnly() $this->tickLoop($this->loop); } - public function testRemoveStream() - { - list ($input, $output) = $this->createSocketPair(); - - $this->loop->addReadStream($input, $this->expectCallableOnce()); - $this->loop->addWriteStream($input, $this->expectCallableOnce()); - - fwrite($output, "bar\n"); - $this->tickLoop($this->loop); - - $this->loop->removeStream($input); - - fwrite($output, "bar\n"); - $this->tickLoop($this->loop); - } - public function testRemoveInvalid() { list ($stream) = $this->createSocketPair(); @@ -186,7 +158,6 @@ public function testRemoveInvalid() // remove a valid stream from the event loop that was never added in the first place $this->loop->removeReadStream($stream); $this->loop->removeWriteStream($stream); - $this->loop->removeStream($stream); } /** @test */ @@ -202,7 +173,7 @@ public function runShouldReturnWhenNoMoreFds() $loop = $this->loop; $this->loop->addReadStream($input, function ($stream) use ($loop) { - $loop->removeStream($stream); + $loop->removeReadStream($stream); }); fwrite($output, "foo\n"); @@ -366,7 +337,7 @@ public function testRunWaitsForFutureTickEvents() $this->loop->addWriteStream( $stream, function () use ($stream) { - $this->loop->removeStream($stream); + $this->loop->removeWriteStream($stream); $this->loop->futureTick( function () { echo 'future-tick' . PHP_EOL; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy