Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
vendor
/
react
/
promise
/
src
:
Deferred.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace React\Promise; /** * @template T */ final class Deferred { /** * @var PromiseInterface<T> */ private $promise; /** @var callable */ private $resolveCallback; /** @var callable */ private $rejectCallback; public function __construct(callable $canceller = null) { $this->promise = new Promise(function ($resolve, $reject): void { $this->resolveCallback = $resolve; $this->rejectCallback = $reject; }, $canceller); } /** * @return PromiseInterface<T> */ public function promise(): PromiseInterface { return $this->promise; } /** * @param T $value */ public function resolve($value): void { ($this->resolveCallback)($value); } public function reject(\Throwable $reason): void { ($this->rejectCallback)($reason); } }