Skip to content

Commit

Permalink
add test for createWithConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Mar 16, 2024
1 parent c6975e5 commit 740492a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
$this->state = self::FULFILLED;

return $response;
}, function ($reason) use ($request) {
}, function ($reason) {
$this->state = self::REJECTED;

if ($reason instanceof HttplugException) {
$this->exception = $reason;
} elseif ($reason instanceof GuzzleExceptions\GuzzleException) {
$this->exception = $this->handleException($reason, $request);
$this->exception = $this->handleException($reason);
} elseif ($reason instanceof \Throwable) {
$this->exception = new HttplugException\TransferException('Invalid exception returned from Guzzle7', 0, $reason);
} else {
Expand All @@ -85,7 +85,7 @@ public function wait($unwrap = true)
$this->promise->wait(false);

if ($unwrap) {
if (self::REJECTED == $this->getState()) {
if (self::REJECTED === $this->getState()) {
throw $this->exception;
}

Expand All @@ -98,7 +98,7 @@ public function wait($unwrap = true)
*
* @return HttplugException
*/
private function handleException(GuzzleExceptions\GuzzleException $exception, RequestInterface $request)
private function handleException(GuzzleExceptions\GuzzleException $exception)
{
if ($exception instanceof GuzzleExceptions\ConnectException) {
return new HttplugException\NetworkException($exception->getMessage(), $exception->getRequest(), $exception);
Expand Down

0 comments on commit 740492a

Please sign in to comment.