-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Document the state object that is passed around by the HttpClient #30967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5a6a40b
to
1407181
Compare
src/Symfony/Component/HttpClient/ClientState/CurlClientState.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpClient/ClientState/NativeClientState.php
Outdated
Show resolved
Hide resolved
ping @nicolas-grekas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like these changes from a reader's perspective, it makes things easier to understand!
@@ -49,7 +50,7 @@ trait ResponseTrait | |||
'error' => null, | |||
]; | |||
|
|||
private $multi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trait itself does not use that property. And since both implementations use different classes for $multi
, I've moved the property to the classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice improvements, thanks :)
src/Symfony/Component/HttpClient/ClientState/CurlClientState.php
Outdated
Show resolved
Hide resolved
@@ -162,7 +166,7 @@ private function open(): void | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
private function close(): void | |||
protected function close(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private was good - traits are not contracts (same below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done inconsistently. Sometimes the overridden trait methods were private, sometimes protected.
Apart from that, PhpStorm has troubles inspecting this, but this is probably something JetBrains should fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symfony\Component\VarDumper\Caster\SymfonyCaster
should be updated for the new type of the multi
property.
actually, there is nothing to do on the topic, the caster just cuts the property: symfony/src/Symfony/Component/VarDumper/Caster/SymfonyCaster.php Lines 44 to 50 in 4e1244e
|
af3eeee
to
2d579d6
Compare
PR is ready for review again. |
ac249d1
to
20f4eb3
Compare
public $hostnames = []; | ||
|
||
/** | ||
* @var string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below you're inlining docblocks into a single line :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I do this here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe multi-line is the most common CS rule in symfony.
Thank you @derrabus. |
…nd by the HttpClient (derrabus) This PR was merged into the 4.3-dev branch. Discussion ---------- [HttpClient] Document the state object that is passed around by the HttpClient | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A In an attempt to make the code of the new HttpClient component more understandable, I've introduced internal classes that document the `$multi` object that is being passed around between *Client and *Response classes. My goal is to make the code more accessible to potential contributors and static code analyzers. Commits ------- 20f4eb3 Document the state object that is passed around by the HttpClient.
In an attempt to make the code of the new HttpClient component more understandable, I've introduced internal classes that document the
$multi
object that is being passed around between *Client and *Response classes.My goal is to make the code more accessible to potential contributors and static code analyzers.