Skip to content

Allow throwing Exception if stream resource is not supported #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ checking whether it is ready to read by this loop implementation.
A single stream resource MUST NOT be added more than once.
Instead, either call [`removeReadStream()`](#removereadstream) first or
react to this event with a single listener and then dispatch from this
listener.
listener. This method MAY throw an `Exception` if the given resource type
is not supported by this loop implementation.

The listener callback function MUST be able to accept a single parameter,
the stream resource added by this method or you MAY use a function which
Expand Down Expand Up @@ -550,7 +551,8 @@ checking whether it is ready to write by this loop implementation.
A single stream resource MUST NOT be added more than once.
Instead, either call [`removeWriteStream()`](#removewritestream) first or
react to this event with a single listener and then dispatch from this
listener.
listener. This method MAY throw an `Exception` if the given resource type
is not supported by this loop implementation.

The listener callback function MUST be able to accept a single parameter,
the stream resource added by this method or you MAY use a function which
Expand Down
8 changes: 6 additions & 2 deletions src/LoopInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ interface LoopInterface
* A single stream resource MUST NOT be added more than once.
* Instead, either call [`removeReadStream()`](#removereadstream) first or
* react to this event with a single listener and then dispatch from this
* listener.
* listener. This method MAY throw an `Exception` if the given resource type
* is not supported by this loop implementation.
*
* The listener callback function MUST be able to accept a single parameter,
* the stream resource added by this method or you MAY use a function which
Expand Down Expand Up @@ -47,6 +48,7 @@ interface LoopInterface
*
* @param resource $stream The PHP stream resource to check.
* @param callable $listener Invoked when the stream is ready.
* @throws \Exception if the given resource type is not supported by this loop implementation
* @see self::removeReadStream()
*/
public function addReadStream($stream, $listener);
Expand All @@ -64,7 +66,8 @@ public function addReadStream($stream, $listener);
* A single stream resource MUST NOT be added more than once.
* Instead, either call [`removeWriteStream()`](#removewritestream) first or
* react to this event with a single listener and then dispatch from this
* listener.
* listener. This method MAY throw an `Exception` if the given resource type
* is not supported by this loop implementation.
*
* The listener callback function MUST be able to accept a single parameter,
* the stream resource added by this method or you MAY use a function which
Expand Down Expand Up @@ -102,6 +105,7 @@ public function addReadStream($stream, $listener);
*
* @param resource $stream The PHP stream resource to check.
* @param callable $listener Invoked when the stream is ready.
* @throws \Exception if the given resource type is not supported by this loop implementation
* @see self::removeWriteStream()
*/
public function addWriteStream($stream, $listener);
Expand Down