1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/lib/Internal/PrivatePromise.php
2017-03-12 17:36:07 +01:00

26 lines
566 B
PHP

<?php
namespace Amp\Internal;
use Amp\CallableMaker;
use Amp\Promise;
/**
* A promise that cannot be externally resolved. Used by Deferred in development mode.
*
* @internal
*/
final class PrivatePromise implements Promise {
use CallableMaker, Placeholder;
/**
* @param callable (callable $resolve, callable $reject): void $resolver
*/
public function __construct(callable $resolver) {
$resolver(
$this->callableFromInstanceMethod("resolve"),
$this->callableFromInstanceMethod("fail")
);
}
}