Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af3eeee

Browse files
committed
Document fields of the NativeClientState.
1 parent 2088b01 commit af3eeee

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/Symfony/Component/HttpClient/ClientState/NativeClientState.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\HttpClient\ClientState;
1313

14+
use Symfony\Component\HttpClient\Response\NativeResponse;
15+
1416
/**
1517
* Internal representation of the native client's state.
1618
*
@@ -20,12 +22,19 @@
2022
*/
2123
final class NativeClientState extends AbstractClientState
2224
{
25+
/** @var int */
2326
public $id;
27+
/** @var NativeResponse[] */
2428
public $pendingResponses = [];
29+
/** @var int */
2530
public $maxHostConnections = PHP_INT_MAX;
31+
/** @var int */
2632
public $responseCount = 0;
33+
/** @var string[] */
2734
public $dnsCache = [];
35+
/** @var resource[] */
2836
public $handles = [];
37+
/** @var bool */
2938
public $sleep = false;
3039

3140
public function __construct()

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ final class CurlResponse implements ResponseInterface
2828
use ResponseTrait;
2929

3030
private static $performing = false;
31+
/** @var CurlClientState */
32+
private $multi;
3133

3234
/**
3335
* @internal

src/Symfony/Component/HttpClient/Response/NativeResponse.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ final class NativeResponse implements ResponseInterface
3434
private $remaining;
3535
private $buffer;
3636
private $inflate;
37+
/** @var NativeClientState */
38+
private $multi;
3739

3840
/**
3941
* @internal
@@ -164,7 +166,7 @@ private function open(): void
164166
/**
165167
* {@inheritdoc}
166168
*/
167-
private function close(): void
169+
protected function close(): void
168170
{
169171
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
170172
$this->handle = $this->buffer = $this->inflate = $this->onProgress = null;
@@ -173,7 +175,7 @@ private function close(): void
173175
/**
174176
* {@inheritdoc}
175177
*/
176-
private static function schedule(self $response, array &$runningResponses): void
178+
protected static function schedule(self $response, array &$runningResponses): void
177179
{
178180
if (!isset($runningResponses[$i = $response->multi->id])) {
179181
$runningResponses[$i] = [$response->multi, []];
@@ -197,7 +199,7 @@ private static function schedule(self $response, array &$runningResponses): void
197199
*
198200
* @param NativeClientState $multi
199201
*/
200-
private static function perform(AbstractClientState $multi, array &$responses = null): void
202+
protected static function perform(AbstractClientState $multi, array &$responses = null): void
201203
{
202204
// List of native handles for stream_select()
203205
if (null !== $responses) {
@@ -287,6 +289,7 @@ private static function perform(AbstractClientState $multi, array &$responses =
287289

288290
if ($multi->pendingResponses && \count($multi->handles) < $multi->maxHostConnections) {
289291
// Open the next pending request - this is a blocking operation so we do only one of them
292+
/** @var self $response */
290293
$response = array_shift($multi->pendingResponses);
291294
$response->open();
292295
$responses[$response->id] = $response;

src/Symfony/Component/HttpClient/Response/ResponseTrait.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ trait ResponseTrait
5050
'error' => null,
5151
];
5252

53-
/** @var AbstractClientState */
54-
private $multi;
53+
/** @var resource */
5554
private $handle;
5655
private $id;
5756
private $timeout;

0 commit comments

Comments
 (0)