1
0
mirror of https://github.com/danog/amp.git synced 2024-12-12 17:37:34 +01:00
amp/lib/Internal/GeneratorStream.php
Aaron Piotrowski 96007f11aa
Add Streams
2020-09-24 12:53:27 -05:00

39 lines
711 B
PHP

<?php
namespace Amp\Internal;
use Amp\AsyncGenerator;
use Amp\Promise;
use Amp\Stream;
/**
* Interface used internally by {@see AsyncGenerator} and {@see Yielder}.
*
* @internal
*
* @template-covariant TValue
* @template TSend
*/
interface GeneratorStream extends Stream
{
/**
* Sends a value into the async generator.
*
* @param mixed $value
*
* @psalm-param TSend $value
*
* @return Promise<array>
*/
public function send($value): Promise;
/**
* Throws an exception into the async generator.
*
* @param \Throwable $exception
*
* @return Promise<array>
*/
public function throw(\Throwable $exception): Promise;
}