Skip to content

Commit 2d74c6b

Browse files
Ensure all properties have a type
1 parent 95c6c23 commit 2d74c6b

File tree

7 files changed

+16
-9
lines changed

7 files changed

+16
-9
lines changed

Internal/AmpClientState.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,16 @@ private function getClient(array $options): array
145145
$options['crypto_method'] && $context = $context->withMinimumVersion($options['crypto_method']);
146146

147147
$connector = $handleConnector = new class() implements Connector {
148-
public $connector;
149-
public $uri;
148+
public DnsConnector $connector;
149+
public string $uri;
150+
/** @var resource|null */
150151
public $handle;
151152

152153
public function connect(string $uri, ConnectContext $context = null, CancellationToken $token = null): Promise
153154
{
154155
$result = $this->connector->connect($this->uri ?? $uri, $context, $token);
155156
$result->onResolve(function ($e, $socket) {
156-
$this->handle = null !== $socket ? $socket->getResource() : false;
157+
$this->handle = $socket?->getResource();
157158
});
158159

159160
return $result;

Internal/AmpListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AmpListener implements EventListener
2828
private array $info;
2929
private array $pinSha256;
3030
private \Closure $onProgress;
31+
/** @var resource|null */
3132
private $handle;
3233

3334
public function __construct(array &$info, array $pinSha256, \Closure $onProgress, &$handle)

Response/AsyncContext.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
*/
2626
final class AsyncContext
2727
{
28+
/** @var callable|null */
2829
private $passthru;
2930
private HttpClientInterface $client;
3031
private ResponseInterface $response;
3132
private array $info = [];
33+
/** @var resource|null */
3234
private $content;
3335
private int $offset;
3436

Response/AsyncResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
3737
private ?HttpClientInterface $client;
3838
private ResponseInterface $response;
3939
private array $info = ['canceled' => false];
40+
/** @var callable|null */
4041
private $passthru;
4142
private ?\Iterator $stream = null;
4243
private ?int $yieldedState = null;

Response/CommonResponseTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ trait CommonResponseTrait
3030
* @var callable|null A callback that tells whether we're waiting for response headers
3131
*/
3232
private $initializer;
33+
/** @var bool|\Closure|resource|null */
3334
private $shouldBuffer;
35+
/** @var resource|null */
3436
private $content;
3537
private int $offset = 0;
3638
private ?array $jsonData = null;

Response/NativeResponse.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ final class NativeResponse implements ResponseInterface, StreamableInterface
3434
*/
3535
private $context;
3636
private string $url;
37-
private $resolver;
38-
private $onProgress;
37+
private \Closure $resolver;
38+
private ?\Closure $onProgress;
3939
private ?int $remaining = null;
4040

4141
/**
@@ -58,8 +58,8 @@ public function __construct(NativeClientState $multi, $context, string $url, arr
5858
$this->logger = $logger;
5959
$this->timeout = $options['timeout'];
6060
$this->info = &$info;
61-
$this->resolver = $resolver;
62-
$this->onProgress = $onProgress;
61+
$this->resolver = $resolver(...);
62+
$this->onProgress = $onProgress ? $onProgress(...) : null;
6363
$this->inflate = !isset($options['normalized_headers']['accept-encoding']);
6464
$this->shouldBuffer = $options['buffer'] ?? true;
6565

@@ -177,7 +177,7 @@ private function open(): void
177177
}
178178

179179
stream_set_blocking($h, false);
180-
$this->context = $this->resolver = null;
180+
unset($this->context, $this->resolver);
181181

182182
// Create dechunk buffers
183183
if (isset($this->headers['content-length'])) {

Response/TransportResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ trait TransportResponseTrait
3838
'canceled' => false,
3939
];
4040

41-
/** @var object|resource */
41+
/** @var object|resource|null */
4242
private $handle;
4343
private int|string $id;
4444
private ?float $timeout = 0;

0 commit comments

Comments
 (0)