Skip to content

Commit 45dd554

Browse files
authored
Merge pull request #33 from marcing/fix/php74-uninitialized-props
fixes PHP (7.4+) errors - "must not be accessed before initialization" in getLastRequest() & getLastResponse()
2 parents bcbdc86 + a7f0d37 commit 45dd554

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Transport.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ final class Transport implements ClientInterface, HttpAsyncClient
5959
private array $headers = [];
6060
private string $user;
6161
private string $password;
62-
private RequestInterface $lastRequest;
63-
private ResponseInterface $lastResponse;
62+
private ?RequestInterface $lastRequest = null;
63+
private ?ResponseInterface $lastResponse = null;
6464
private string $OSVersion;
6565
private int $retries = 0;
6666
private HttpAsyncClient $asyncClient;
@@ -190,12 +190,12 @@ private function purgePreReleaseTag(string $version): string
190190
return str_replace(['alpha', 'beta', 'snapshot', 'rc', 'pre'], 'p', strtolower($version));
191191
}
192192

193-
public function getLastRequest(): RequestInterface
193+
public function getLastRequest(): ?RequestInterface
194194
{
195195
return $this->lastRequest;
196196
}
197197

198-
public function getLastResponse(): ResponseInterface
198+
public function getLastResponse(): ?ResponseInterface
199199
{
200200
return $this->lastResponse;
201201
}

0 commit comments

Comments
 (0)