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

62 lines
997 B
PHP
Raw Normal View History

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