1
0
mirror of https://github.com/danog/amp.git synced 2024-12-12 17:37:34 +01:00
amp/lib/Internal/GeneratorStream.php

39 lines
711 B
PHP
Raw Normal View History

2020-05-13 17:15:21 +02:00
<?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;
}