Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient]  deprecate setLogger() methods of decorating clients #54806

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

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE-7.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Components
* [ExpressionLanguage](#ExpressionLanguage)
* [Form](#Form)
* [Intl](#Intl)
* [HttpClient](#HttpClient)
* [PropertyInfo](#PropertyInfo)
* [Translation](#Translation)
* [Workflow](#Workflow)
Expand Down Expand Up @@ -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
----

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpClient/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/HttpClient/ScopingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/HttpClient/TraceableHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down