public function cancel($promise)
    {
        $hash = spl_object_hash($promise);
        if (!$this->isPromise($promise) || !isset($this->cancellers[$hash])) {
            throw new \InvalidArgumentException(sprintf('The "%s" method must be called with a compatible Promise.', __METHOD__));
        }
        $canceller = $this->cancellers[$hash];
        unset($this->cancellers[$hash]);
        $adoptedPromise = $promise;
        if ($promise instanceof Promise) {
            $adoptedPromise = $promise->adoptedPromise;
        }
        try {
            $canceller([$adoptedPromise, 'resolve'], [$adoptedPromise, 'reject']);
        } catch (\Exception $reason) {
            $adoptedPromise->reject($reason);
        }
    }
public function cancel($promise)
    {
        $hash = spl_object_hash($promise);
        if (!$this->isPromise($promise) || !isset($this->cancellers[$hash])) {
            throw new \InvalidArgumentException(sprintf('The "%s" method must be called with a compatible Promise.', __METHOD__));
        }
        $canceller = $this->cancellers[$hash];
        unset($this->cancellers[$hash]);
        $adoptedPromise = $promise;
        if ($promise instanceof Promise) {
            $adoptedPromise = $promise->adoptedPromise;
        }
        try {
            $canceller([$adoptedPromise, 'resolve'], [$adoptedPromise, 'reject']);
        } catch (\Exception $reason) {
            $adoptedPromise->reject($reason);
        }
    }
public function cancel ( $ promise ) { $ hash = spl_object_hash ( $ promise ) ; if ( ! $ this -> isPromise ( $ promise ) || ! isset ( $ this -> cancellers [ $ hash ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The "%s" method must be called with a compatible Promise.' , __METHOD__ ) ) ; } $ canceller = $ this -> cancellers [ $ hash ] ; unset ( $ this -> cancellers [ $ hash ] ) ; $ adoptedPromise = $ promise ; if ( $ promise instanceof Promise ) { $ adoptedPromise = $ promise -> adoptedPromise ; } try { $ canceller ( [ $ adoptedPromise , 'resolve' ] , [ $ adoptedPromise , 'reject' ] ) ; } catch ( \ Exception $ reason ) { $ adoptedPromise -> reject ( $ reason ) ; } }
{@inheritdoc}
{