From 291aafff2eccf2ce1a8408a25ac730936aeb2898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Tue, 2 May 2017 10:15:46 +0200 Subject: [PATCH] Explicitly allow custom events and exclude any semantics --- README.md | 27 +++++++++++++++++++++++++++ src/DuplexStreamInterface.php | 9 +++++++++ src/ReadableStreamInterface.php | 9 +++++++++ src/WritableStreamInterface.php | 9 +++++++++ 4 files changed, 54 insertions(+) diff --git a/README.md b/README.md index 86a6a28..dce4b60 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,15 @@ read-only streams and the readable side of duplex streams. Besides defining a few methods, this interface also implements the `EventEmitterInterface` which allows you to react to certain events. +Every implementation of this interface MUST follow these event semantics in +order to be considered a well-behaving stream. + +> Note that higher-level implementations of this interface may choose to + define additional events with dedicated semantics not defined as part of + this low-level stream specification. Conformance with these event semantics + is out of scope for this interface, so you may also have to refer to the + documentation of such a higher-level implementation. + #### data event 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. Besides defining a few methods, this interface also implements the `EventEmitterInterface` which allows you to react to certain events. +Every implementation of this interface MUST follow these event semantics in +order to be considered a well-behaving stream. + +> Note that higher-level implementations of this interface may choose to + define additional events with dedicated semantics not defined as part of + this low-level stream specification. Conformance with these event semantics + is out of scope for this interface, so you may also have to refer to the + documentation of such a higher-level implementation. + #### drain event 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 `EventEmitterInterface` which allows you to react to the same events defined on the `ReadbleStreamInterface` and `WritableStreamInterface`. +Every implementation of this interface MUST follow these event semantics in +order to be considered a well-behaving stream. + +> Note that higher-level implementations of this interface may choose to + define additional events with dedicated semantics not defined as part of + this low-level stream specification. Conformance with these event semantics + is out of scope for this interface, so you may also have to refer to the + documentation of such a higher-level implementation. + See also [`ReadableStreamInterface`](#readablestreaminterface) and [`WritableStreamInterface`](#writablestreaminterface) for more details. diff --git a/src/DuplexStreamInterface.php b/src/DuplexStreamInterface.php index d0575da..cd58b57 100644 --- a/src/DuplexStreamInterface.php +++ b/src/DuplexStreamInterface.php @@ -15,6 +15,15 @@ * `EventEmitterInterface` which allows you to react to the same events defined * on the `ReadbleStreamInterface` and `WritableStreamInterface`. * + * Every implementation of this interface MUST follow these event semantics in + * order to be considered a well-behaving stream. + * + * > Note that higher-level implementations of this interface may choose to + * define additional events with dedicated semantics not defined as part of + * this low-level stream specification. Conformance with these event semantics + * is out of scope for this interface, so you may also have to refer to the + * documentation of such a higher-level implementation. + * * @see ReadableStreamInterface * @see WritableStreamInterface */ diff --git a/src/ReadableStreamInterface.php b/src/ReadableStreamInterface.php index 87c5ad3..0ad9e65 100644 --- a/src/ReadableStreamInterface.php +++ b/src/ReadableStreamInterface.php @@ -144,6 +144,15 @@ * non-writable AND non-readable mode, see also `isWritable()`. * Note that this event should not be confused with the `end` event. * + * Every implementation of this interface MUST follow these event semantics in + * order to be considered a well-behaving stream. + * + * > Note that higher-level implementations of this interface may choose to + * define additional events with dedicated semantics not defined as part of + * this low-level stream specification. Conformance with these event semantics + * is out of scope for this interface, so you may also have to refer to the + * documentation of such a higher-level implementation. + * * @see EventEmitterInterface */ interface ReadableStreamInterface extends EventEmitterInterface diff --git a/src/WritableStreamInterface.php b/src/WritableStreamInterface.php index c991201..6b8b90d 100644 --- a/src/WritableStreamInterface.php +++ b/src/WritableStreamInterface.php @@ -120,6 +120,15 @@ * non-writable AND non-readable mode, see also `isReadable()`. * Note that this event should not be confused with the `end` event. * + * Every implementation of this interface MUST follow these event semantics in + * order to be considered a well-behaving stream. + * + * > Note that higher-level implementations of this interface may choose to + * define additional events with dedicated semantics not defined as part of + * this low-level stream specification. Conformance with these event semantics + * is out of scope for this interface, so you may also have to refer to the + * documentation of such a higher-level implementation. + * * @see EventEmitterInterface * @see DuplexStreamInterface */