You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Reaching here when the stream buffer goes above the max size,
69
71
// in this example that is 1024 bytes,
70
-
// or when the stream emits an error.
72
+
// or when the stream emits an error.
71
73
});
72
74
```
73
75
74
76
### first()
75
77
76
-
The `first(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data')`
77
-
function can be used to create a `Promise` which resolves once the given event triggers for the first time.
78
+
The `first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<mixed,Exception>` function can be used to
79
+
create a `Promise` which resolves once the given event triggers for the first time.
78
80
79
81
```php
80
82
$stream = accessSomeJsonStream();
@@ -97,12 +99,12 @@ The promise will reject once the stream closes – unless you're waiting for the
97
99
98
100
The promise will reject if the stream is already closed.
99
101
100
-
The promise will reject if it is canceled.
102
+
The promise will reject if it is cancelled.
101
103
102
104
### all()
103
105
104
-
The `all(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data')`
105
-
function can be used to create a `Promise` which resolves with an array of all the event data.
106
+
The `all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<array,Exception>` function can be used to
107
+
create a `Promise` which resolves with an array of all the event data.
106
108
107
109
```php
108
110
$stream = accessSomeJsonStream();
@@ -123,12 +125,12 @@ The promise will resolve with an empty array if the stream is already closed.
123
125
124
126
The promise will reject if the stream emits an error.
125
127
126
-
The promise will reject if it is canceled.
128
+
The promise will reject if it is cancelled.
127
129
128
130
### unwrapReadable()
129
131
130
-
The `unwrapReadable(PromiseInterface $promise)` function can be used to unwrap
131
-
a `Promise` which resolves with a `ReadableStreamInterface`.
132
+
The `unwrapReadable(PromiseInterface<ReadableStreamInterface,Exception> $promise): ReadableStreamInterface` function can be used to
133
+
unwrap a `Promise` which resolves with a `ReadableStreamInterface`.
132
134
133
135
This function returns a readable stream instance (implementing `ReadableStreamInterface`)
134
136
right away which acts as a proxy for the future promise resolution.
0 commit comments