-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Consistent semantics for DuplexStreamInterface::end() to ensure it SHOULD also end readable side #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo, LGTM otherwise.
README.md
Outdated
@@ -629,6 +629,16 @@ $stream->write('nope'); // NO-OP | |||
$stream->end(); // NO-OP | |||
``` | |||
|
|||
If this stream is a `DuplexStreamInterface`, calling this method SHOULD | |||
also end its readable side, unless the stream supports half-open mode. | |||
In other words, after calling this method, these stream SHOULD switch into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the/this stream SHOULD
src/WritableStreamInterface.php
Outdated
@@ -262,6 +262,16 @@ public function write($data); | |||
* $stream->end(); // NO-OP | |||
* ``` | |||
* | |||
* If this stream is a `DuplexStreamInterface`, calling this method SHOULD | |||
* also end its readable side, unless the stream supports half-open mode. | |||
* In other words, after calling this method, these stream SHOULD switch into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the/this stream
Thanks for spotting, typos fixed and squashed |
The semantics for this are currently not explicit and the
DuplexResourceStream
(previouslyStream
) class has a very unclearend()
logic implemented. It currently turns the stream into non-readable mode but keeps emitting readable events despite.This PR ensures we use consistent semantics to ensure duplex streams SHOULD also end the readable side (unless this is a stream that supports half-open mode, see #27).
This should in fact not break any of the existing assumptions and as such should not be considered a BC break. Given that this current behavior was mostly underdocumented or undocumented, I'll mark this as a BC break just to be safe in case any implementation relies on undocumented features which might now be prohibited.
Builds on top of #72.