2017-03-10 21:58:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Representation of the future value of an asynchronous operation.
|
|
|
|
*/
|
|
|
|
interface Promise {
|
|
|
|
/**
|
|
|
|
* Registers a callback to be invoked when the promise is resolved.
|
|
|
|
*
|
|
|
|
* If the promise is already resolved, the callback MUST be executed immediately.
|
|
|
|
*
|
2017-03-14 18:24:14 +01:00
|
|
|
* @param callable(\Throwable|null $reason, $value) $onResolved `$reason` shall be `null` on
|
2017-03-10 21:58:46 +01:00
|
|
|
* success, `$value` shall be `null` on failure.
|
|
|
|
*
|
|
|
|
* @return mixed Return type and value are unspecified.
|
|
|
|
*/
|
2017-03-21 17:23:37 +01:00
|
|
|
public function onResolve(callable $onResolved);
|
2017-03-10 21:58:46 +01:00
|
|
|
}
|