diff --git a/UPGRADE-7.1.md b/UPGRADE-7.1.md index 89113e16ac815..51b5e994b3861 100644 --- a/UPGRADE-7.1.md +++ b/UPGRADE-7.1.md @@ -29,6 +29,7 @@ Components * [ExpressionLanguage](#ExpressionLanguage) * [Form](#Form) * [Intl](#Intl) + * [HttpClient](#HttpClient) * [PropertyInfo](#PropertyInfo) * [Translation](#Translation) * [Workflow](#Workflow) @@ -72,6 +73,11 @@ FrameworkBundle * Deprecate the `router.cache_dir` config option, the Router will always use the `kernel.build_dir` parameter * Reset env vars when resetting the container +HttpClient +---------- + + * Deprecate the `setLogger()` methods of the `NoPrivateNetworkHttpClient`, `TraceableHttpClient` and `ScopingHttpClient` classes, configure the logger of the wrapped clients directly instead + Intl ---- diff --git a/src/Symfony/Component/HttpClient/CHANGELOG.md b/src/Symfony/Component/HttpClient/CHANGELOG.md index 0b6ceba0851c5..0ed7e9082318a 100644 --- a/src/Symfony/Component/HttpClient/CHANGELOG.md +++ b/src/Symfony/Component/HttpClient/CHANGELOG.md @@ -8,6 +8,7 @@ CHANGELOG * Allow mocking `start_time` info in `MockResponse` * Add `MockResponse::fromFile()` and `JsonMockResponse::fromFile()` methods to help using fixtures files * Add `ThrottlingHttpClient` to enable limiting the number of requests within a certain period + * Deprecate the `setLogger()` methods of the `NoPrivateNetworkHttpClient`, `TraceableHttpClient` and `ScopingHttpClient` classes, configure the logger of the wrapped clients directly instead 7.0 --- diff --git a/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php b/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php index 7bfe24db20330..3b930ad3ad051 100644 --- a/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php +++ b/src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php @@ -77,8 +77,13 @@ public function stream(ResponseInterface|iterable $responses, ?float $timeout = return $this->client->stream($responses, $timeout); } + /** + * @deprecated since Symfony 7.1, configure the logger on the wrapper HTTP client directly instead + */ public function setLogger(LoggerInterface $logger): void { + trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapper HTTP client directly instead.'); + if ($this->client instanceof LoggerAwareInterface) { $this->client->setLogger($logger); } diff --git a/src/Symfony/Component/HttpClient/ScopingHttpClient.php b/src/Symfony/Component/HttpClient/ScopingHttpClient.php index 5734d3e4e7c5a..0086b2d1eb6d5 100644 --- a/src/Symfony/Component/HttpClient/ScopingHttpClient.php +++ b/src/Symfony/Component/HttpClient/ScopingHttpClient.php @@ -100,8 +100,13 @@ public function reset(): void } } + /** + * @deprecated since Symfony 7.1, configure the logger on the wrapper HTTP client directly instead + */ public function setLogger(LoggerInterface $logger): void { + trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapper HTTP client directly instead.'); + if ($this->client instanceof LoggerAwareInterface) { $this->client->setLogger($logger); } diff --git a/src/Symfony/Component/HttpClient/TraceableHttpClient.php b/src/Symfony/Component/HttpClient/TraceableHttpClient.php index 9f1bd515e0914..b6d30dab7ea81 100644 --- a/src/Symfony/Component/HttpClient/TraceableHttpClient.php +++ b/src/Symfony/Component/HttpClient/TraceableHttpClient.php @@ -89,8 +89,13 @@ public function reset(): void $this->tracedRequests->exchangeArray([]); } + /** + * @deprecated since Symfony 7.1, configure the logger on the wrapper HTTP client directly instead + */ public function setLogger(LoggerInterface $logger): void { + trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapper HTTP client directly instead.'); + if ($this->client instanceof LoggerAwareInterface) { $this->client->setLogger($logger); }