Skip to content

Commit 291aaff

Browse files
committed
Explicitly allow custom events and exclude any semantics
1 parent 64c88fa commit 291aaff

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ 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+
Every implementation of this interface MUST follow these event semantics in
57+
order to be considered a well-behaving stream.
58+
59+
> Note that higher-level implementations of this interface may choose to
60+
define additional events with dedicated semantics not defined as part of
61+
this low-level stream specification. Conformance with these event semantics
62+
is out of scope for this interface, so you may also have to refer to the
63+
documentation of such a higher-level implementation.
64+
5665
#### data event
5766

5867
The `data` event will be emitted whenever some data was read/received
@@ -383,6 +392,15 @@ write-only streams and the writable side of duplex streams.
383392
Besides defining a few methods, this interface also implements the
384393
`EventEmitterInterface` which allows you to react to certain events.
385394

395+
Every implementation of this interface MUST follow these event semantics in
396+
order to be considered a well-behaving stream.
397+
398+
> Note that higher-level implementations of this interface may choose to
399+
define additional events with dedicated semantics not defined as part of
400+
this low-level stream specification. Conformance with these event semantics
401+
is out of scope for this interface, so you may also have to refer to the
402+
documentation of such a higher-level implementation.
403+
386404
#### drain event
387405

388406
The `drain` event will be emitted whenever the write buffer became full
@@ -703,6 +721,15 @@ Besides defining a few methods, this interface also implements the
703721
`EventEmitterInterface` which allows you to react to the same events defined
704722
on the `ReadbleStreamInterface` and `WritableStreamInterface`.
705723

724+
Every implementation of this interface MUST follow these event semantics in
725+
order to be considered a well-behaving stream.
726+
727+
> Note that higher-level implementations of this interface may choose to
728+
define additional events with dedicated semantics not defined as part of
729+
this low-level stream specification. Conformance with these event semantics
730+
is out of scope for this interface, so you may also have to refer to the
731+
documentation of such a higher-level implementation.
732+
706733
See also [`ReadableStreamInterface`](#readablestreaminterface) and
707734
[`WritableStreamInterface`](#writablestreaminterface) for more details.
708735

src/DuplexStreamInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
* `EventEmitterInterface` which allows you to react to the same events defined
1616
* on the `ReadbleStreamInterface` and `WritableStreamInterface`.
1717
*
18+
* Every implementation of this interface MUST follow these event semantics in
19+
* order to be considered a well-behaving stream.
20+
*
21+
* > Note that higher-level implementations of this interface may choose to
22+
* define additional events with dedicated semantics not defined as part of
23+
* this low-level stream specification. Conformance with these event semantics
24+
* is out of scope for this interface, so you may also have to refer to the
25+
* documentation of such a higher-level implementation.
26+
*
1827
* @see ReadableStreamInterface
1928
* @see WritableStreamInterface
2029
*/

src/ReadableStreamInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@
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+
* Every implementation of this interface MUST follow these event semantics in
148+
* order to be considered a well-behaving stream.
149+
*
150+
* > Note that higher-level implementations of this interface may choose to
151+
* define additional events with dedicated semantics not defined as part of
152+
* this low-level stream specification. Conformance with these event semantics
153+
* is out of scope for this interface, so you may also have to refer to the
154+
* documentation of such a higher-level implementation.
155+
*
147156
* @see EventEmitterInterface
148157
*/
149158
interface ReadableStreamInterface extends EventEmitterInterface

src/WritableStreamInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@
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+
* Every implementation of this interface MUST follow these event semantics in
124+
* order to be considered a well-behaving stream.
125+
*
126+
* > Note that higher-level implementations of this interface may choose to
127+
* define additional events with dedicated semantics not defined as part of
128+
* this low-level stream specification. Conformance with these event semantics
129+
* is out of scope for this interface, so you may also have to refer to the
130+
* documentation of such a higher-level implementation.
131+
*
123132
* @see EventEmitterInterface
124133
* @see DuplexStreamInterface
125134
*/

0 commit comments

Comments
 (0)