1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 19:07:00 +01:00
psalm/src/Psalm/Internal/Stubs/Amp.php

47 lines
969 B
PHP
Raw Normal View History

<?php
namespace Amp;
/**
* @template TReturn
* @param callable():\Generator<mixed, mixed, mixed, TReturn> $gen
2019-02-06 21:52:43 +01:00
* @return callable():Promise<TReturn>
*/
2019-02-06 21:52:43 +01:00
function coroutine(callable $gen) : callable {}
/**
* @template TReturn
2019-02-06 15:14:02 +01:00
* @param callable():(\Generator<mixed, mixed, mixed, TReturn>|TReturn) $gen
* @return Promise<TReturn>
*/
function call(callable $gen) : Promise {}
2019-02-06 15:14:02 +01:00
/**
* @template TReturn
*/
interface Promise {
/**
* @param callable(\Throwable|null $exception, TReturn|null $result):void
* @return void
*/
function onResolve(callable $onResolved);
}
/**
* @template TReturn
*
* @template-implements Promise<TReturn>
*/
class Success implements Promise {
2019-02-06 15:14:02 +01:00
/**
* @param TReturn|null $value
*/
public function __construct($value = null) {}
/**
* @param callable(\Throwable|null $exception, TReturn|null $result):void
* @return void
*/
function onResolve(callable $onResolved) {}
}