Skip to content

Commit 07ce778

Browse files
Don't temprarily violate property types in the flexible http client
1 parent 09979e6 commit 07ce778

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/FlexibleHttpClient.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,7 @@ public function __construct($client)
3030
);
3131
}
3232

33-
$this->httpClient = $client;
34-
$this->httpAsyncClient = $client;
35-
36-
if (!($this->httpClient instanceof ClientInterface)) {
37-
$this->httpClient = new EmulatedHttpClient($this->httpClient);
38-
}
39-
40-
if (!($this->httpAsyncClient instanceof HttpAsyncClient)) {
41-
$this->httpAsyncClient = new EmulatedHttpAsyncClient($this->httpAsyncClient);
42-
}
33+
$this->httpClient = $client instanceof ClientInterface ? $client : new EmulatedHttpClient($client);
34+
$this->httpAsyncClient = $client instanceof HttpAsyncClient ? $client : new EmulatedHttpAsyncClient($client);
4335
}
4436
}

0 commit comments

Comments
 (0)