Skip to content

Commit 709e36b

Browse files
committed
Template params can only have one argument
The fact that a promise can also be rejected with a Throwable and/or Exception is implied and there is no need to also define that here. Refs: reactphp/promise#223
1 parent 0df894e commit 709e36b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Stream\buffer(…);
4747

4848
### buffer()
4949

50-
The `buffer(ReadableStreamInterface<string> $stream, ?int $maxLength = null): PromiseInterface<string,RuntimeException>` function can be used to
50+
The `buffer(ReadableStreamInterface<string> $stream, ?int $maxLength = null): PromiseInterface<string>` function can be used to
5151
create a `Promise` which will be fulfilled with the stream data buffer.
5252

5353
```php
@@ -84,7 +84,7 @@ React\Promise\Stream\buffer($stream, 1024)->then(function ($contents) {
8484

8585
### first()
8686

87-
The `first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<mixed,RuntimeException>` function can be used to
87+
The `first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<mixed>` function can be used to
8888
create a `Promise` which will be fulfilled once the given event triggers for the first time.
8989

9090
```php
@@ -114,7 +114,7 @@ The promise will be rejected with a `RuntimeException` if it is cancelled.
114114

115115
### all()
116116

117-
The `all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<array,RuntimeException>` function can be used to
117+
The `all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<array>` function can be used to
118118
create a `Promise` which will be fulfilled with an array of all the event data.
119119

120120
```php
@@ -140,7 +140,7 @@ The promise will be rejected with a `RuntimeException` if it is cancelled.
140140

141141
### unwrapReadable()
142142

143-
The `unwrapReadable(PromiseInterface<ReadableStreamInterface<T>,Exception> $promise): ReadableStreamInterface<T>` function can be used to
143+
The `unwrapReadable(PromiseInterface<ReadableStreamInterface<T>> $promise): ReadableStreamInterface<T>` function can be used to
144144
unwrap a `Promise` which will be fulfilled with a `ReadableStreamInterface<T>`.
145145

146146
This function returns a readable stream instance (implementing `ReadableStreamInterface<T>`)
@@ -197,7 +197,7 @@ $loop->addTimer(2.0, function () use ($stream) {
197197

198198
### unwrapWritable()
199199

200-
The `unwrapWritable(PromiseInterface<WritableStreamInterface<T>,Exception> $promise): WritableStreamInterface<T>` function can be used to
200+
The `unwrapWritable(PromiseInterface<WritableStreamInterface<T>> $promise): WritableStreamInterface<T>` function can be used to
201201
unwrap a `Promise` which will be fulfilled with a `WritableStreamInterface<T>`.
202202

203203
This function returns a writable stream instance (implementing `WritableStreamInterface<T>`)

src/functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*
4646
* @param ReadableStreamInterface<string> $stream
4747
* @param ?int $maxLength Maximum number of bytes to buffer or null for unlimited.
48-
* @return PromiseInterface<string,\RuntimeException>
48+
* @return PromiseInterface<string>
4949
*/
5050
function buffer(ReadableStreamInterface $stream, $maxLength = null)
5151
{
@@ -121,7 +121,7 @@ function buffer(ReadableStreamInterface $stream, $maxLength = null)
121121
*
122122
* @param ReadableStreamInterface|WritableStreamInterface $stream
123123
* @param string $event
124-
* @return PromiseInterface<mixed,\RuntimeException>
124+
* @return PromiseInterface<mixed>
125125
*/
126126
function first(EventEmitterInterface $stream, $event = 'data')
127127
{
@@ -192,7 +192,7 @@ function first(EventEmitterInterface $stream, $event = 'data')
192192
*
193193
* @param ReadableStreamInterface|WritableStreamInterface $stream
194194
* @param string $event
195-
* @return PromiseInterface<array,\RuntimeException>
195+
* @return PromiseInterface<array>
196196
*/
197197
function all(EventEmitterInterface $stream, $event = 'data')
198198
{
@@ -296,7 +296,7 @@ function all(EventEmitterInterface $stream, $event = 'data')
296296
* });
297297
* ```
298298
*
299-
* @param PromiseInterface<ReadableStreamInterface<T>,\Exception> $promise
299+
* @param PromiseInterface<ReadableStreamInterface<T>> $promise
300300
* @return ReadableStreamInterface<T>
301301
*/
302302
function unwrapReadable(PromiseInterface $promise)
@@ -361,7 +361,7 @@ function unwrapReadable(PromiseInterface $promise)
361361
* });
362362
* ```
363363
*
364-
* @param PromiseInterface<WritableStreamInterface<T>,\Exception> $promise
364+
* @param PromiseInterface<WritableStreamInterface<T>> $promise
365365
* @return WritableStreamInterface<T>
366366
*/
367367
function unwrapWritable(PromiseInterface $promise)

0 commit comments

Comments
 (0)