diff --git a/lib/Stream.php b/lib/ByteStream.php similarity index 97% rename from lib/Stream.php rename to lib/ByteStream.php index 499f578..c317dee 100644 --- a/lib/Stream.php +++ b/lib/ByteStream.php @@ -4,7 +4,7 @@ namespace Amp\Stream; use AsyncInterop\Promise; -interface Stream { +interface ByteStream { /** * Determines if the stream is readable. * diff --git a/lib/MemoryStream.php b/lib/MemoryStream.php index 357e59d..ff9c41a 100644 --- a/lib/MemoryStream.php +++ b/lib/MemoryStream.php @@ -10,7 +10,7 @@ use AsyncInterop\Promise; * the buffer. This class by itself is not particularly useful, but it can be extended to add functionality upon reading * or writing, as well as acting as an example of how stream classes can be implemented. */ -class MemoryStream implements Stream { +class MemoryStream implements ByteStream { /** @var \Amp\Stream\Buffer */ private $buffer; diff --git a/lib/functions.php b/lib/functions.php index 0c1748c..43c979f 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -13,13 +13,12 @@ if (\strlen('…') !== 3) { } // @codeCoverageIgnoreEnd /** - * @param \Amp\Stream\Stream $source - * @param \Amp\Stream\Stream $destination + * @param \Amp\Stream\ByteStream $source + * @param \Amp\Stream\ByteStream $destination * @param int|null $bytes * * @return \AsyncInterop\Promise */ -function pipe(Stream $source, Stream $destination, int $bytes = null): Promise { return new Coroutine(__doPipe($source, $destination, $bytes)); } @@ -43,4 +42,5 @@ function __doPipe(Stream $source, Stream $destination, int $bytes = null): \Gene } while ($source->isReadable() && $destination->isWritable()); return $written; +function pipe(ByteStream $source, ByteStream $destination, int $bytes = null): Promise { }