diff --git a/lib/Internal/Producer.php b/lib/Internal/Producer.php index 5e1a25a1..628197e6 100644 --- a/lib/Internal/Producer.php +++ b/lib/Internal/Producer.php @@ -68,7 +68,7 @@ public function advance(): Promise { */ public function getCurrent() { if (empty($this->values) && $this->complete) { - throw new \Error("The stream has completed"); + throw new \Error("The iterator has completed"); } if (!\array_key_exists($this->position, $this->values)) { @@ -79,18 +79,18 @@ public function getCurrent() { } /** - * Emits a value from the stream. The returned promise is resolved with the emitted value once all listeners + * Emits a value from the iterator. The returned promise is resolved with the emitted value once all listeners * have been invoked. * * @param mixed $value * * @return \Amp\Promise * - * @throws \Error If the stream has completed. + * @throws \Error If the iterator has completed. */ private function emit($value): Promise { if ($this->complete) { - throw new \Error("Streams cannot emit values after calling complete"); + throw new \Error("Iterators cannot emit values after calling complete"); } if ($value instanceof ReactPromise) { @@ -102,7 +102,7 @@ private function emit($value): Promise { $value->onResolve(function ($e, $v) use ($deferred) { if ($this->complete) { $deferred->fail( - new \Error("The stream was completed before the promise result could be emitted") + new \Error("The iterator was completed before the promise result could be emitted") ); return; } @@ -134,7 +134,7 @@ private function emit($value): Promise { /** * Completes the iterator. * - * @throws \Error If the stream has already been completed. + * @throws \Error If the iterator has already been completed. */ private function complete() { if ($this->complete) { diff --git a/test/ProducerTraitTest.php b/test/ProducerTraitTest.php index 423dc480..579f3c0f 100644 --- a/test/ProducerTraitTest.php +++ b/test/ProducerTraitTest.php @@ -134,7 +134,7 @@ public function testEmitPendingPromiseThenNonPromise() { /** * @depends testEmit * @expectedException \Error - * @expectedExceptionMessage Streams cannot emit values after calling complete + * @expectedExceptionMessage Iterators cannot emit values after calling complete */ public function testEmitAfterComplete() { $this->producer->complete(); @@ -144,7 +144,7 @@ public function testEmitAfterComplete() { /** * @depends testEmit * @expectedException \Error - * @expectedExceptionMessage The stream was completed before the promise result could be emitted + * @expectedExceptionMessage The iterator was completed before the promise result could be emitted */ public function testEmitPendingPromiseThenComplete() { $invoked = false; @@ -167,7 +167,7 @@ public function testEmitPendingPromiseThenComplete() { /** * @depends testEmit * @expectedException \Error - * @expectedExceptionMessage The stream was completed before the promise result could be emitted + * @expectedExceptionMessage The iterator was completed before the promise result could be emitted */ public function testEmitPendingPromiseThenFail() { $invoked = false;