-
Notifications
You must be signed in to change notification settings - Fork 6
Fix composer version conflict with react/http v0.8 #28
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
Changes from 1 commit
1a91065
f305b04
4e2ca57
07dfeda
4389772
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,9 @@ | |
use React\EventLoop\Factory as EventLoopFactory; | ||
use React\Dns\Resolver\Resolver as DnsResolver; | ||
use React\Dns\Resolver\Factory as DnsResolverFactory; | ||
use React\HttpClient\Factory as HttpClientFactory; | ||
use React\HttpClient\Client as HttpClient; | ||
use React\Socket\Connector; | ||
use React\Socket\DnsConnector; | ||
|
||
/** | ||
* Factory wrapper for React instances. | ||
|
@@ -54,13 +55,26 @@ public static function buildDnsResolver( | |
public static function buildHttpClient( | ||
LoopInterface $loop, | ||
DnsResolver $dns = null | ||
) { | ||
$dnsConnector = static::buildDnsConnector($loop, $dns); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did the react client constructor signature change to expect the dns connector instead of the dns resolver? no auto-instantiation? if so, we should probably follow the pattern of the DnsResolver and add another optional parameter for the connector. hm, but $dns is never needed when you pass the whole connector. maybe remove the typehint from $dns and do instanceof to see if its the resolver or the connector? and deprecate passing only the resolver? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes it did. There is auto-instantiation though, the dns connector could be omitted, and we could simply deprecate the entire $dns param for the About your suggestion, doing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would just add the flexibility but deprecate passing the resolver and recommend to pass the connector. i think the factory should keep allowing a custom dns resolution tool. in a version 2 we can then add the typehint for the connector and thus drop dns resolver support in the http client factory method. |
||
|
||
return new HttpClient($loop, $dnsConnector); | ||
} | ||
|
||
/** | ||
* @param LoopInterface $loop | ||
* @param DnsResolver|null $dns | ||
* | ||
* @return DnsConnector | ||
*/ | ||
public static function buildDnsConnector( | ||
LoopInterface $loop, | ||
DnsResolver $dns = null | ||
) { | ||
if (null === $dns) { | ||
$dns = self::buildDnsResolver($loop); | ||
} | ||
|
||
$factory = new HttpClientFactory(); | ||
|
||
return $factory->create($loop, $dns); | ||
return new DnsConnector(new Connector($loop), $dns); | ||
} | ||
} |
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.
can we keep allowing 0.4.8 or are there BC breaks?
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.
Unfortunately there are: https://github.com/reactphp/http-client/releases/tag/v0.5.0
Furthermore,
\React\HttpClient\Client
's constructor signature has changed, so even calling it directly instead of usingFactory
won't work the same in v0.4 and v0.5.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.
okay. i suggest we bump the minor version of this library then, and deprecate passing the dns resolver but still support it (see my comment above)
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 think we can be BC here and keep 0.4.8 by checking if this
React\HttpClient\Factory
class exists, then use old behavior in that case, otherwise use the new behavior