protected function settle(PromiseInterface $promise) { $handlers = $this->handlers; $this->result = $promise; $this->handlers = []; foreach ($handlers as $handler) { $handler($promise); } return $promise; }