From b606aeca53d4730c13588af1fecb9b6f36e256af Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 21 Jan 2023 14:51:55 +0100 Subject: [PATCH] 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: https://github.com/reactphp/promise/pull/223 --- README.md | 10 +++++----- src/UnwrapReadableStream.php | 2 +- src/UnwrapWritableStream.php | 2 +- src/functions.php | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8b97339..60880fb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Stream\buffer(…); ### buffer() -The `buffer(ReadableStreamInterface $stream, ?int $maxLength = null): PromiseInterface` function can be used to +The `buffer(ReadableStreamInterface $stream, ?int $maxLength = null): PromiseInterface` function can be used to create a `Promise` which will be fulfilled with the stream data buffer. ```php @@ -84,7 +84,7 @@ React\Promise\Stream\buffer($stream, 1024)->then(function ($contents) { ### first() -The `first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface` function can be used to +The `first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface` function can be used to create a `Promise` which will be fulfilled once the given event triggers for the first time. ```php @@ -114,7 +114,7 @@ The promise will be rejected with a `RuntimeException` if it is cancelled. ### all() -The `all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface` function can be used to +The `all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface` function can be used to create a `Promise` which will be fulfilled with an array of all the event data. ```php @@ -140,7 +140,7 @@ The promise will be rejected with a `RuntimeException` if it is cancelled. ### unwrapReadable() -The `unwrapReadable(PromiseInterface,Exception> $promise): ReadableStreamInterface` function can be used to +The `unwrapReadable(PromiseInterface> $promise): ReadableStreamInterface` function can be used to unwrap a `Promise` which will be fulfilled with a `ReadableStreamInterface`. This function returns a readable stream instance (implementing `ReadableStreamInterface`) @@ -197,7 +197,7 @@ $loop->addTimer(2.0, function () use ($stream) { ### unwrapWritable() -The `unwrapWritable(PromiseInterface,Exception> $promise): WritableStreamInterface` function can be used to +The `unwrapWritable(PromiseInterface> $promise): WritableStreamInterface` function can be used to unwrap a `Promise` which will be fulfilled with a `WritableStreamInterface`. This function returns a writable stream instance (implementing `WritableStreamInterface`) diff --git a/src/UnwrapReadableStream.php b/src/UnwrapReadableStream.php index b1725f5..536ac92 100644 --- a/src/UnwrapReadableStream.php +++ b/src/UnwrapReadableStream.php @@ -21,7 +21,7 @@ class UnwrapReadableStream extends EventEmitter implements ReadableStreamInterfa /** * Instantiate new unwrapped readable stream for given `Promise` which resolves with a `ReadableStreamInterface`. * - * @param PromiseInterface $promise Promise + * @param PromiseInterface $promise */ public function __construct(PromiseInterface $promise) { diff --git a/src/UnwrapWritableStream.php b/src/UnwrapWritableStream.php index 85730e9..0554209 100644 --- a/src/UnwrapWritableStream.php +++ b/src/UnwrapWritableStream.php @@ -22,7 +22,7 @@ class UnwrapWritableStream extends EventEmitter implements WritableStreamInterfa /** * Instantiate new unwrapped writable stream for given `Promise` which resolves with a `WritableStreamInterface`. * - * @param PromiseInterface $promise Promise + * @param PromiseInterface $promise */ public function __construct(PromiseInterface $promise) { diff --git a/src/functions.php b/src/functions.php index da66de8..12acf9a 100644 --- a/src/functions.php +++ b/src/functions.php @@ -45,7 +45,7 @@ * * @param ReadableStreamInterface $stream * @param ?int $maxLength Maximum number of bytes to buffer or null for unlimited. - * @return PromiseInterface + * @return PromiseInterface */ function buffer(ReadableStreamInterface $stream, $maxLength = null) { @@ -121,7 +121,7 @@ function buffer(ReadableStreamInterface $stream, $maxLength = null) * * @param ReadableStreamInterface|WritableStreamInterface $stream * @param string $event - * @return PromiseInterface + * @return PromiseInterface */ function first(EventEmitterInterface $stream, $event = 'data') { @@ -192,7 +192,7 @@ function first(EventEmitterInterface $stream, $event = 'data') * * @param ReadableStreamInterface|WritableStreamInterface $stream * @param string $event - * @return PromiseInterface + * @return PromiseInterface */ function all(EventEmitterInterface $stream, $event = 'data') { @@ -296,7 +296,7 @@ function all(EventEmitterInterface $stream, $event = 'data') * }); * ``` * - * @param PromiseInterface,\Exception> $promise + * @param PromiseInterface> $promise * @return ReadableStreamInterface */ function unwrapReadable(PromiseInterface $promise) @@ -361,7 +361,7 @@ function unwrapReadable(PromiseInterface $promise) * }); * ``` * - * @param PromiseInterface,\Exception> $promise + * @param PromiseInterface> $promise * @return WritableStreamInterface */ function unwrapWritable(PromiseInterface $promise)