Skip to content

Commit 1823123

Browse files
authored
Merge pull request #101 from clue-labs/event-callbacks
Strict definition for event callback functions
2 parents 78a94e8 + feae8c5 commit 1823123

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ read-only streams and the readable side of duplex streams.
5353
Besides defining a few methods, this interface also implements the
5454
`EventEmitterInterface` which allows you to react to certain events.
5555

56+
The event callback functions MUST be a valid `callable` that obeys strict
57+
parameter definitions and MUST accept event parameters exactly as documented.
58+
The event callback functions MUST NOT throw an `Exception`.
59+
The return value of the event callback functions will be ignored and has no
60+
effect, so for performance reasons you're recommended to not return any
61+
excessive data structures.
62+
5663
Every implementation of this interface MUST follow these event semantics in
5764
order to be considered a well-behaving stream.
5865

@@ -392,6 +399,13 @@ write-only streams and the writable side of duplex streams.
392399
Besides defining a few methods, this interface also implements the
393400
`EventEmitterInterface` which allows you to react to certain events.
394401

402+
The event callback functions MUST be a valid `callable` that obeys strict
403+
parameter definitions and MUST accept event parameters exactly as documented.
404+
The event callback functions MUST NOT throw an `Exception`.
405+
The return value of the event callback functions will be ignored and has no
406+
effect, so for performance reasons you're recommended to not return any
407+
excessive data structures.
408+
395409
Every implementation of this interface MUST follow these event semantics in
396410
order to be considered a well-behaving stream.
397411

@@ -721,6 +735,13 @@ Besides defining a few methods, this interface also implements the
721735
`EventEmitterInterface` which allows you to react to the same events defined
722736
on the `ReadbleStreamInterface` and `WritableStreamInterface`.
723737

738+
The event callback functions MUST be a valid `callable` that obeys strict
739+
parameter definitions and MUST accept event parameters exactly as documented.
740+
The event callback functions MUST NOT throw an `Exception`.
741+
The return value of the event callback functions will be ignored and has no
742+
effect, so for performance reasons you're recommended to not return any
743+
excessive data structures.
744+
724745
Every implementation of this interface MUST follow these event semantics in
725746
order to be considered a well-behaving stream.
726747

src/DuplexStreamInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* `EventEmitterInterface` which allows you to react to the same events defined
1616
* on the `ReadbleStreamInterface` and `WritableStreamInterface`.
1717
*
18+
* The event callback functions MUST be a valid `callable` that obeys strict
19+
* parameter definitions and MUST accept event parameters exactly as documented.
20+
* The event callback functions MUST NOT throw an `Exception`.
21+
* The return value of the event callback functions will be ignored and has no
22+
* effect, so for performance reasons you're recommended to not return any
23+
* excessive data structures.
24+
*
1825
* Every implementation of this interface MUST follow these event semantics in
1926
* order to be considered a well-behaving stream.
2027
*

src/ReadableStreamInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@
144144
* non-writable AND non-readable mode, see also `isWritable()`.
145145
* Note that this event should not be confused with the `end` event.
146146
*
147+
* The event callback functions MUST be a valid `callable` that obeys strict
148+
* parameter definitions and MUST accept event parameters exactly as documented.
149+
* The event callback functions MUST NOT throw an `Exception`.
150+
* The return value of the event callback functions will be ignored and has no
151+
* effect, so for performance reasons you're recommended to not return any
152+
* excessive data structures.
153+
*
147154
* Every implementation of this interface MUST follow these event semantics in
148155
* order to be considered a well-behaving stream.
149156
*

src/WritableStreamInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@
120120
* non-writable AND non-readable mode, see also `isReadable()`.
121121
* Note that this event should not be confused with the `end` event.
122122
*
123+
* The event callback functions MUST be a valid `callable` that obeys strict
124+
* parameter definitions and MUST accept event parameters exactly as documented.
125+
* The event callback functions MUST NOT throw an `Exception`.
126+
* The return value of the event callback functions will be ignored and has no
127+
* effect, so for performance reasons you're recommended to not return any
128+
* excessive data structures.
129+
*
123130
* Every implementation of this interface MUST follow these event semantics in
124131
* order to be considered a well-behaving stream.
125132
*

0 commit comments

Comments
 (0)