diff --git a/lib/Internal/Producer.php b/lib/Internal/Producer.php index ad6a786..33751a3 100644 --- a/lib/Internal/Producer.php +++ b/lib/Internal/Producer.php @@ -15,6 +15,7 @@ use React\Promise\PromiseInterface as ReactPromise; * before emitting values. * * @internal + * @template-covariant TValue */ trait Producer { @@ -41,6 +42,8 @@ trait Producer /** * {@inheritdoc} + * + * @return Promise */ public function advance(): Promise { @@ -72,6 +75,8 @@ trait Producer /** * {@inheritdoc} + * + * @return Promise */ public function getCurrent() { diff --git a/lib/Producer.php b/lib/Producer.php index 828f2c8..82895f6 100644 --- a/lib/Producer.php +++ b/lib/Producer.php @@ -2,12 +2,19 @@ namespace Amp; +/** + * @template-covariant TValue + * @template-implements Iterator + */ final class Producer implements Iterator { + /** + * @use Internal\Producer + */ use CallableMaker, Internal\Producer; /** - * @param callable(callable(mixed $value): Promise $emit): \Generator $producer + * @param callable(callable(TValue $value): Promise $emit): \Generator $producer * * @throws \Error Thrown if the callable does not return a Generator. */ diff --git a/psalm.xml b/psalm.xml index 4605917..fe548ca 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,7 @@