Skip to content

Commit 98d6f59

Browse files
nicolas-grekasfabpot
authored andcommitted
Bump minimum version of PHP to 8.1
1 parent 2b5da21 commit 98d6f59

File tree

8 files changed

+7
-10
lines changed

8 files changed

+7
-10
lines changed

AmpHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface,
5656
*/
5757
public function __construct(array $defaultOptions = [], callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50)
5858
{
59-
$this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']);
59+
$this->defaultOptions['buffer'] ??= self::shouldBuffer(...);
6060

6161
if ($defaultOptions) {
6262
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);

CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(array $defaultOptions = [], int $maxHostConnections
6464
throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.');
6565
}
6666

67-
$this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']);
67+
$this->defaultOptions['buffer'] ??= self::shouldBuffer(...);
6868

6969
if ($defaultOptions) {
7070
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);

Internal/AmpClientState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class AmpClientState extends ClientState
5454
public function __construct(?callable $clientConfigurator, int $maxHostConnections, int $maxPendingPushes, ?LoggerInterface &$logger)
5555
{
5656
$clientConfigurator ??= static fn (PooledHttpClient $client) => new InterceptedHttpClient($client, new RetryRequests(2));
57-
$this->clientConfigurator = $clientConfigurator instanceof \Closure ? $clientConfigurator : \Closure::fromCallable($clientConfigurator);
57+
$this->clientConfigurator = $clientConfigurator(...);
5858

5959
$this->maxHostConnections = $maxHostConnections;
6060
$this->maxPendingPushes = $maxPendingPushes;

MockHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function setResponseFactory($responseFactory): void
5656
})();
5757
}
5858

59-
$this->responseFactory = !\is_callable($responseFactory) || $responseFactory instanceof \Closure ? $responseFactory : \Closure::fromCallable($responseFactory);
59+
$this->responseFactory = !\is_callable($responseFactory) ? $responseFactory : $responseFactory(...);
6060
}
6161

6262
/**

NativeHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
4747
*/
4848
public function __construct(array $defaultOptions = [], int $maxHostConnections = 6)
4949
{
50-
$this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']);
50+
$this->defaultOptions['buffer'] ??= self::shouldBuffer(...);
5151

5252
if ($defaultOptions) {
5353
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);

Tests/CurlHttpClientTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function testBindToPort()
3838
$response->getStatusCode();
3939

4040
$r = new \ReflectionProperty($response, 'handle');
41-
$r->setAccessible(true);
4241

4342
$curlInfo = curl_getinfo($r->getValue($response));
4443

@@ -60,7 +59,6 @@ public function testHandleIsReinitOnReset()
6059
$httpClient = $this->getHttpClient(__FUNCTION__);
6160

6261
$r = new \ReflectionProperty($httpClient, 'multi');
63-
$r->setAccessible(true);
6462
$clientState = $r->getValue($httpClient);
6563
$initialShareId = $clientState->share;
6664
$httpClient->reset();

Tests/HttpClientTestCase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ private static function startVulcain(HttpClientInterface $client)
321321
]);
322322
$process->start();
323323

324-
register_shutdown_function([$process, 'stop']);
324+
register_shutdown_function($process->stop(...));
325325
sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1);
326326

327327
if (!$process->isRunning()) {
@@ -353,7 +353,6 @@ public function testHandleIsRemovedOnException()
353353
unset($e);
354354

355355
$r = new \ReflectionProperty($client, 'multi');
356-
$r->setAccessible(true);
357356
/** @var ClientState $clientState */
358357
$clientState = $r->getValue($client);
359358

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/http-client-implementation": "3.0"
2222
},
2323
"require": {
24-
"php": ">=8.0.2",
24+
"php": ">=8.1",
2525
"psr/log": "^1|^2|^3",
2626
"symfony/http-client-contracts": "^3",
2727
"symfony/service-contracts": "^1.0|^2|^3"

0 commit comments

Comments
 (0)