Skip to content

Commit a63040c

Browse files
authored
Merge branch '2.x' into feature/php-81
2 parents 4b4092c + 0cfe985 commit a63040c

12 files changed

+21
-16
lines changed

Diff for: .github/workflows/tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php: ['8.1', '8.2', '8.3']
15+
php: ['8.1', '8.2', '8.3', '8.4']
1616

1717
steps:
1818
- name: Checkout code
@@ -25,6 +25,10 @@ jobs:
2525
tools: composer:v2
2626
coverage: none
2727

28+
- name: Emulate PHP 8.3
29+
run: composer config platform.php 8.3.999
30+
if: matrix.php == '8.4'
31+
2832
- name: Install PHP dependencies
2933
run: composer update --prefer-dist --no-interaction --no-progress
3034

Diff for: CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Change Log
22

3-
## unreleased
3+
## 2.7.2 - 2024-09-24
44

5+
- Updated code to not raise warnings for nullable parameters in PHP 8.4.
56
- drop support for php < 8.1
67
- drop support for symfony < 5.4
7-
- Cleaned up phpdoc.
8+
- Cleaned up PHPDoc comments.
89

910
## 2.7.1 - 2023-11-30
1011

Diff for: src/Deferred.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(callable $waitCallback)
5151
$this->onRejectedCallbacks = [];
5252
}
5353

54-
public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
54+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
5555
{
5656
$deferred = new self($this->waitCallback);
5757

Diff for: src/Exception/HttpClientNoMatchException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class HttpClientNoMatchException extends TransferException
1919
*/
2020
private $request;
2121

22-
public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
22+
public function __construct(string $message, RequestInterface $request, ?\Exception $previous = null)
2323
{
2424
$this->request = $request;
2525

Diff for: src/HttpClientPool/HttpClientPoolItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
5757
* @param ClientInterface|HttpAsyncClient $client
5858
* @param int|null $reenableAfter Number of seconds until this client is enabled again after an error
5959
*/
60-
public function __construct($client, int $reenableAfter = null)
60+
public function __construct($client, ?int $reenableAfter = null)
6161
{
6262
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
6363
throw new \TypeError(

Diff for: src/HttpMethodsClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class HttpMethodsClient implements HttpMethodsClientInterface
3333
/**
3434
* @param RequestFactory|RequestFactoryInterface $requestFactory
3535
*/
36-
public function __construct(ClientInterface $httpClient, $requestFactory, StreamFactoryInterface $streamFactory = null)
36+
public function __construct(ClientInterface $httpClient, $requestFactory, ?StreamFactoryInterface $streamFactory = null)
3737
{
3838
if (!$requestFactory instanceof RequestFactory && !$requestFactory instanceof RequestFactoryInterface) {
3939
throw new \TypeError(

Diff for: src/Plugin/CookiePlugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private function createCookie(RequestInterface $request, string $setCookieHeader
164164
*
165165
* @param string $part A single cookie value in format key=value
166166
*
167-
* @return array{0:string, 1:?string}
167+
* @return array{0:string, 1:string|null}
168168
*/
169169
private function createValueKey(string $part): array
170170
{

Diff for: src/Plugin/RedirectPlugin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ final class RedirectPlugin implements Plugin
113113
private $streamFactory;
114114

115115
/**
116-
* @param array{'preserve_header'?: bool|string[], 'use_default_for_multiple'?: bool, 'strict'?: bool} $config
116+
* @param array{'preserve_header'?: bool|string[], 'use_default_for_multiple'?: bool, 'strict'?: bool, 'stream_factory'?:StreamFactoryInterface} $config
117117
*
118118
* Configuration options:
119119
* - preserve_header: True keeps all headers, false remove all of them, an array is interpreted as a list of header names to keep
@@ -218,7 +218,7 @@ public function guessStreamFactory(): ?StreamFactoryInterface
218218
return new Psr17Factory();
219219
}
220220
if (class_exists(Utils::class)) {
221-
return new class() implements StreamFactoryInterface {
221+
return new class implements StreamFactoryInterface {
222222
public function createStream(string $content = ''): StreamInterface
223223
{
224224
return Utils::streamFor($content);

Diff for: src/Plugin/RequestMatcherPlugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class RequestMatcherPlugin implements Plugin
3131
*/
3232
private $failurePlugin;
3333

34-
public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, Plugin $delegateOnNoMatch = null)
34+
public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, ?Plugin $delegateOnNoMatch = null)
3535
{
3636
$this->requestMatcher = $requestMatcher;
3737
$this->successPlugin = $delegateOnMatch;

Diff for: tests/HttpMethodsClientTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testOptions(): void
7373
*
7474
* As there is no data provider in phpspec, we keep separate methods to get new mocks for each test.
7575
*/
76-
private function expectSendRequest(string $method, string $body = null): void
76+
private function expectSendRequest(string $method, ?string $body = null): void
7777
{
7878
$response = new Response();
7979
$this->httpClient->expects($this->once())

Diff for: tests/Plugin/RedirectPluginTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function provideRedirections(): array
9393
'relative-path with ./' => ['https://example.com:8000/path/', './other?query=value', 'https://example.com:8000/path/other?query=value'],
9494
'relative-path with //' => ['https://example.com:8000/path/', 'other//sub?query=value', 'https://example.com:8000/path/other//sub?query=value'],
9595
'relative-path redirect with only query' => ['https://example.com:8000/path', '?query=value', 'https://example.com:8000/path?query=value'],
96-
];
96+
];
9797
}
9898

9999
/**

Diff for: tests/PluginClientTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ public function testRestartChain(PluginClient $client, string $method, string $r
3333

3434
public static function clientAndMethodProvider()
3535
{
36-
$syncClient = new class() implements ClientInterface {
36+
$syncClient = new class implements ClientInterface {
3737
public function sendRequest(RequestInterface $request): ResponseInterface
3838
{
3939
return new Response();
4040
}
4141
};
4242

43-
$asyncClient = new class() implements HttpAsyncClient {
43+
$asyncClient = new class implements HttpAsyncClient {
4444
public function sendAsyncRequest(RequestInterface $request)
4545
{
4646
return new HttpFulfilledPromise(new Response());
@@ -49,7 +49,7 @@ public function sendAsyncRequest(RequestInterface $request)
4949

5050
$headerAppendPlugin = new HeaderAppendPlugin(['Content-Type' => 'text/html']);
5151
$redirectPlugin = new RedirectPlugin();
52-
$restartOncePlugin = new class() implements Plugin {
52+
$restartOncePlugin = new class implements Plugin {
5353
private $firstRun = true;
5454

5555
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise

0 commit comments

Comments
 (0)