public function whenComplete($action) { return $this->then(function ($v) use($action) { call_user_func($action); return $v; }, function ($e) use($action) { call_user_func($action); throw $e; }); }