File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 3838 "php-http/message" : " ^1.7" ,
3939 "php-http/mock-client" : " ^1.0" ,
4040 "php-http/message-factory" : " ^1.1" ,
41- "symfony/http-client" : " ^5.4 || ^6.4" ,
41+ "symfony/http-client" : " ^5.4 || ^6.4 || ^7.0 " ,
4242 "nyholm/psr7" : " ^1.0"
4343 },
4444 "scripts" : {
Original file line number Diff line number Diff line change 1414namespace Exchanger \Service ;
1515
1616use Http \Client \HttpClient ;
17+ use Http \Discovery \Exception \NotFoundException ;
1718use Http \Discovery \HttpClientDiscovery ;
1819use Http \Discovery \Psr17FactoryDiscovery ;
20+ use Http \Discovery \Psr18ClientDiscovery ;
1921use Psr \Http \Client \ClientInterface ;
2022use Psr \Http \Message \RequestFactoryInterface ;
2123use Psr \Http \Message \RequestInterface ;
@@ -50,7 +52,11 @@ abstract class HttpService extends Service
5052 public function __construct ($ httpClient = null , RequestFactoryInterface $ requestFactory = null , array $ options = [])
5153 {
5254 if (null === $ httpClient ) {
53- $ httpClient = HttpClientDiscovery::find ();
55+ try {
56+ $ httpClient = Psr18ClientDiscovery::find ();
57+ } catch (NotFoundException $ e ) {
58+ $ httpClient = HttpClientDiscovery::find ();
59+ }
5460 } else {
5561 if (!$ httpClient instanceof ClientInterface && !$ httpClient instanceof HttpClient) {
5662 throw new \LogicException ('Client must be an instance of Http \\Client \\HttpClient or Psr \\Http \\Client \\ClientInterface ' );
You can’t perform that action at this time.
0 commit comments