Skip to content

Commit 24ec434

Browse files
Revert "[HttpClient] Add support for "friendsofphp/well-known-implementations""
This reverts commit b814ce8f2dd54571a5458682959f3dce730e50a4.
1 parent f1f48a9 commit 24ec434

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ CHANGELOG
77
* Make `HttplugClient` implement `Psr\Http\Message\RequestFactoryInterface`, `StreamFactoryInterface` and `UriFactoryInterface`
88
* Deprecate implementing `Http\Message\RequestFactory`, `StreamFactory` and `UriFactory` on `HttplugClient`
99
* Add `withOptions()` to `HttplugClient` and `Psr18Client`
10-
* Add support for "friendsofphp/well-known-implementations"
1110

1211
6.1
1312
---

HttplugClient.php

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

1212
namespace Symfony\Component\HttpClient;
1313

14-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr17Factory;
15-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr7Request;
16-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr7Uri;
1714
use GuzzleHttp\Promise\Promise as GuzzlePromise;
1815
use GuzzleHttp\Promise\RejectedPromise;
1916
use GuzzleHttp\Promise\Utils;
@@ -84,12 +81,12 @@ public function __construct(HttpClientInterface $client = null, ResponseFactoryI
8481
$this->promisePool = class_exists(Utils::class) ? new \SplObjectStorage() : null;
8582

8683
if (null === $responseFactory || null === $streamFactory) {
87-
if (!class_exists(Psr17Factory::class) && !class_exists(WellKnownPsr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) {
84+
if (!class_exists(Psr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) {
8885
throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\HttplugClient" as no PSR-17 factories have been provided. Try running "composer require nyholm/psr7".');
8986
}
9087

9188
try {
92-
$psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : (class_exists(WellKnownPsr17Factory::class, false) ? new WellKnownPsr17Factory() : null);
89+
$psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : null;
9390
$responseFactory ??= $psr17Factory ?? Psr17FactoryDiscovery::findResponseFactory();
9491
$streamFactory ??= $psr17Factory ?? Psr17FactoryDiscovery::findStreamFactory();
9592
} catch (NotFoundException $e) {
@@ -170,8 +167,6 @@ public function createRequest($method, $uri, array $headers = [], $body = null,
170167
$request = $this->responseFactory->createRequest($method, $uri);
171168
} elseif (class_exists(Request::class)) {
172169
$request = new Request($method, $uri);
173-
} elseif (class_exists(WellKnownPsr7Request::class)) {
174-
$request = new WellKnownPsr7Request($method, $uri);
175170
} elseif (class_exists(Psr17FactoryDiscovery::class)) {
176171
$request = Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $uri);
177172
} else {
@@ -249,10 +244,6 @@ public function createUri($uri = ''): UriInterface
249244
return new Uri($uri);
250245
}
251246

252-
if (class_exists(WellKnownPsr7Uri::class)) {
253-
return new WellKnownPsr7Uri($uri);
254-
}
255-
256247
if (class_exists(Psr17FactoryDiscovery::class)) {
257248
return Psr17FactoryDiscovery::findUrlFactory()->createUri($uri);
258249
}

Psr18Client.php

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

1212
namespace Symfony\Component\HttpClient;
1313

14-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr17Factory;
15-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr7Request;
16-
use FriendsOfPHP\WellKnownImplementations\WellKnownPsr7Uri;
1714
use Http\Discovery\Exception\NotFoundException;
1815
use Http\Discovery\Psr17FactoryDiscovery;
1916
use Nyholm\Psr7\Factory\Psr17Factory;
@@ -65,12 +62,12 @@ public function __construct(HttpClientInterface $client = null, ResponseFactoryI
6562
$streamFactory ??= $responseFactory instanceof StreamFactoryInterface ? $responseFactory : null;
6663

6764
if (null === $responseFactory || null === $streamFactory) {
68-
if (!class_exists(Psr17Factory::class) && !class_exists(WellKnownPsr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) {
65+
if (!class_exists(Psr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) {
6966
throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as no PSR-17 factories have been provided. Try running "composer require nyholm/psr7".');
7067
}
7168

7269
try {
73-
$psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : (class_exists(WellKnownPsr17Factory::class, false) ? new WellKnownPsr17Factory() : null);
70+
$psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : null;
7471
$responseFactory ??= $psr17Factory ?? Psr17FactoryDiscovery::findResponseFactory();
7572
$streamFactory ??= $psr17Factory ?? Psr17FactoryDiscovery::findStreamFactory();
7673
} catch (NotFoundException $e) {
@@ -149,10 +146,6 @@ public function createRequest(string $method, $uri): RequestInterface
149146
return new Request($method, $uri);
150147
}
151148

152-
if (class_exists(WellKnownPsr7Request::class)) {
153-
return new WellKnownPsr7Request($method, $uri);
154-
}
155-
156149
if (class_exists(Psr17FactoryDiscovery::class)) {
157150
return Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $uri);
158151
}
@@ -191,10 +184,6 @@ public function createUri(string $uri = ''): UriInterface
191184
return new Uri($uri);
192185
}
193186

194-
if (class_exists(WellKnownPsr7Uri::class)) {
195-
return new WellKnownPsr7Uri($uri);
196-
}
197-
198187
if (class_exists(Psr17FactoryDiscovery::class)) {
199188
return Psr17FactoryDiscovery::findUrlFactory()->createUri($uri);
200189
}

0 commit comments

Comments
 (0)