public function addOnRejected(callable $callback): void
    {
        if ($this->getState() === Promise::PENDING) {
            $this->onRejected[] = $callback;
        } elseif ($this->getState() === Promise::REJECTED) {
            $this->exception = call_user_func($callback, $this->exception);
        }
    }
public function addOnRejected(callable $callback): void
    {
        if ($this->getState() === Promise::PENDING) {
            $this->onRejected[] = $callback;
        } elseif ($this->getState() === Promise::REJECTED) {
            $this->exception = call_user_func($callback, $this->exception);
        }
    }
public function addOnRejected ( callable $ callback ) : void { if ( $ this -> getState ( ) === Promise :: PENDING ) { $ this -> onRejected [ ] = $ callback ; } elseif ( $ this -> getState ( ) === Promise :: REJECTED ) { $ this -> exception = call_user_func ( $ callback , $ this -> exception ) ; } }
Add on rejected callback.

@param callable $callback
Add on rejected callback .