Skip to content

Commit c6bf4dc

Browse files
[HttpClient] Remove setLogger() methods on decorators
1 parent 841d322 commit c6bf4dc

File tree

6 files changed

+5
-43
lines changed

6 files changed

+5
-43
lines changed

UPGRADE-8.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ HttpClient
1010
----------
1111

1212
* Remove support for amphp/http-client < 5
13+
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead
1314

1415
TwigBridge
1516
----------

src/Symfony/Component/HttpClient/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Remove support for amphp/http-client < 5
8+
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead
89

910
7.4
1011
---

src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\HttpClient;
1313

14-
use Psr\Log\LoggerAwareInterface;
1514
use Psr\Log\LoggerInterface;
1615
use Symfony\Component\HttpClient\Exception\TransportException;
1716
use Symfony\Component\HttpClient\Response\AsyncContext;
@@ -28,7 +27,7 @@
2827
* @author Hallison Boaventura <hallisonboaventura@gmail.com>
2928
* @author Nicolas Grekas <p@tchwork.com>
3029
*/
31-
final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface
30+
final class NoPrivateNetworkHttpClient implements HttpClientInterface, ResetInterface
3231
{
3332
use AsyncDecoratorTrait;
3433
use HttpClientTrait;
@@ -159,18 +158,6 @@ public function request(string $method, string $url, array $options = []): Respo
159158
});
160159
}
161160

162-
/**
163-
* @deprecated since Symfony 7.1, configure the logger on the wrapped HTTP client directly instead
164-
*/
165-
public function setLogger(LoggerInterface $logger): void
166-
{
167-
trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapped HTTP client directly instead.');
168-
169-
if ($this->client instanceof LoggerAwareInterface) {
170-
$this->client->setLogger($logger);
171-
}
172-
}
173-
174161
public function withOptions(array $options): static
175162
{
176163
$clone = clone $this;

src/Symfony/Component/HttpClient/ScopingHttpClient.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\HttpClient;
1313

14-
use Psr\Log\LoggerAwareInterface;
1514
use Psr\Log\LoggerInterface;
1615
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
1716
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -24,7 +23,7 @@
2423
*
2524
* @author Anthony Martin <anthony.martin@sensiolabs.com>
2625
*/
27-
class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface
26+
class ScopingHttpClient implements HttpClientInterface, ResetInterface
2827
{
2928
use HttpClientTrait;
3029

@@ -95,18 +94,6 @@ public function reset(): void
9594
}
9695
}
9796

98-
/**
99-
* @deprecated since Symfony 7.1, configure the logger on the wrapped HTTP client directly instead
100-
*/
101-
public function setLogger(LoggerInterface $logger): void
102-
{
103-
trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapped HTTP client directly instead.');
104-
105-
if ($this->client instanceof LoggerAwareInterface) {
106-
$this->client->setLogger($logger);
107-
}
108-
}
109-
11097
public function withOptions(array $options): static
11198
{
11299
$clone = clone $this;

src/Symfony/Component/HttpClient/TraceableHttpClient.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\HttpClient;
1313

14-
use Psr\Log\LoggerAwareInterface;
1514
use Psr\Log\LoggerInterface;
1615
use Symfony\Component\HttpClient\Response\ResponseStream;
1716
use Symfony\Component\HttpClient\Response\TraceableResponse;
@@ -24,7 +23,7 @@
2423
/**
2524
* @author Jérémy Romey <jeremy@free-agent.fr>
2625
*/
27-
final class TraceableHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface
26+
final class TraceableHttpClient implements HttpClientInterface, ResetInterface
2827
{
2928
private \ArrayObject $tracedRequests;
3029

@@ -94,18 +93,6 @@ public function reset(): void
9493
$this->tracedRequests->exchangeArray([]);
9594
}
9695

97-
/**
98-
* @deprecated since Symfony 7.1, configure the logger on the wrapped HTTP client directly instead
99-
*/
100-
public function setLogger(LoggerInterface $logger): void
101-
{
102-
trigger_deprecation('symfony/http-client', '7.1', 'Configure the logger on the wrapped HTTP client directly instead.');
103-
104-
if ($this->client instanceof LoggerAwareInterface) {
105-
$this->client->setLogger($logger);
106-
}
107-
}
108-
10996
public function withOptions(array $options): static
11097
{
11198
$clone = clone $this;

src/Symfony/Component/HttpClient/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"require": {
2525
"php": ">=8.4",
2626
"psr/log": "^1|^2|^3",
27-
"symfony/deprecation-contracts": "^2.5|^3",
2827
"symfony/http-client-contracts": "~3.4.4|^3.5.2",
2928
"symfony/service-contracts": "^2.5|^3"
3029
},

0 commit comments

Comments
 (0)