Skip to content

Commit 1fb6a4b

Browse files
authored
Merge pull request #158 from clue-labs/exception
Allow throwing Exception if stream resource is not supported
2 parents de1fb5e + 73933b6 commit 1fb6a4b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ checking whether it is ready to read by this loop implementation.
499499
A single stream resource MUST NOT be added more than once.
500500
Instead, either call [`removeReadStream()`](#removereadstream) first or
501501
react to this event with a single listener and then dispatch from this
502-
listener.
502+
listener. This method MAY throw an `Exception` if the given resource type
503+
is not supported by this loop implementation.
503504

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

555557
The listener callback function MUST be able to accept a single parameter,
556558
the stream resource added by this method or you MAY use a function which

src/LoopInterface.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ interface LoopInterface
1717
* A single stream resource MUST NOT be added more than once.
1818
* Instead, either call [`removeReadStream()`](#removereadstream) first or
1919
* react to this event with a single listener and then dispatch from this
20-
* listener.
20+
* listener. This method MAY throw an `Exception` if the given resource type
21+
* is not supported by this loop implementation.
2122
*
2223
* The listener callback function MUST be able to accept a single parameter,
2324
* the stream resource added by this method or you MAY use a function which
@@ -47,6 +48,7 @@ interface LoopInterface
4748
*
4849
* @param resource $stream The PHP stream resource to check.
4950
* @param callable $listener Invoked when the stream is ready.
51+
* @throws \Exception if the given resource type is not supported by this loop implementation
5052
* @see self::removeReadStream()
5153
*/
5254
public function addReadStream($stream, $listener);
@@ -64,7 +66,8 @@ public function addReadStream($stream, $listener);
6466
* A single stream resource MUST NOT be added more than once.
6567
* Instead, either call [`removeWriteStream()`](#removewritestream) first or
6668
* react to this event with a single listener and then dispatch from this
67-
* listener.
69+
* listener. This method MAY throw an `Exception` if the given resource type
70+
* is not supported by this loop implementation.
6871
*
6972
* The listener callback function MUST be able to accept a single parameter,
7073
* the stream resource added by this method or you MAY use a function which
@@ -102,6 +105,7 @@ public function addReadStream($stream, $listener);
102105
*
103106
* @param resource $stream The PHP stream resource to check.
104107
* @param callable $listener Invoked when the stream is ready.
108+
* @throws \Exception if the given resource type is not supported by this loop implementation
105109
* @see self::removeWriteStream()
106110
*/
107111
public function addWriteStream($stream, $listener);

0 commit comments

Comments
 (0)
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