Files
assets
data
dependencies
amphp
amp
lib
Internal
Loop
CallableMaker.php
CancellationToken.php
CancellationTokenSource.php
CancelledException.php
Coroutine.php
Deferred.php
Delayed.php
Emitter.php
Failure.php
InvalidYieldError.php
Iterator.php
LazyPromise.php
Loop.php
MultiReasonException.php
NullCancellationToken.php
Producer.php
Promise.php
Struct.php
Success.php
TimeoutCancellationToken.php
TimeoutException.php
functions.php
byte-stream
cache
dns
hpack
http
http-client
parser
process
serialization
socket
sync
windows-registry
berlindb
composer
daverandom
delight-im
doctrine
guzzlehttp
hashids
ifsnop
jasny
kelunik
league
mexitek
mpdf
myclabs
nesbot
nyholm
pablo-sg-pacheco
paragonie
phpdocumentor
phpseclib
phpstan
psr
rakit
ralouphie
remotelyliving
rpnzl
scssphp
setasign
spatie
stripe
symfony
webmozart
woocommerce
yahnis-elsts
autoload.php
scoper-autoload.php
inc
lang
views
.gitignore
LICENSE
autoload.php
composer.json
constants.php
loco.xml
readme.txt
sunrise.php
uninstall.php
wp-multisite-waas.php
wp-multisite-waas/dependencies/amphp/amp/lib/Promise.php
2024-11-30 18:24:12 -07:00

38 lines
1.4 KiB
PHP

<?php
namespace WP_Ultimo\Dependencies\Amp;
/**
* Representation of the future value of an asynchronous operation.
*
* @template-covariant TValue
* @psalm-yield TValue
*/
interface Promise
{
/**
* Registers a callback to be invoked when the promise is resolved.
*
* If this method is called multiple times, additional handlers will be registered instead of replacing any already
* existing handlers.
*
* If the promise is already resolved, the callback MUST be executed immediately.
*
* Exceptions MUST NOT be thrown from this method. Any exceptions thrown from invoked callbacks MUST be
* forwarded to the event-loop error handler.
*
* Note: You shouldn't implement this interface yourself. Instead, provide a method that returns a promise for the
* operation you're implementing. Objects other than pure placeholders implementing it are a very bad idea.
*
* @param callable $onResolved The first argument shall be `null` on success, while the second shall be `null` on
* failure.
*
* @psalm-param callable(\Throwable|null, mixed): (Promise|\React\Promise\PromiseInterface|\Generator<mixed,
* Promise|\React\Promise\PromiseInterface|array<array-key, Promise|\React\Promise\PromiseInterface>, mixed,
* mixed>|null) | callable(\Throwable|null, mixed): void $onResolved
*
* @return void
*/
public function onResolve(callable $onResolved);
}