Skip to content

Commit c94d01b

Browse files
authored
Merge pull request #439 from Art4/update-libraries
Update libraries
2 parents 2bcffdd + 1918ec5 commit c94d01b

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

Diff for: .github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125

126126
- name: Upload coverage reports to Codecov
127127
if: ${{ matrix.tool == 'code-coverage' }}
128-
uses: codecov/codecov-action@v4
128+
uses: codecov/codecov-action@v5
129129
with:
130130
token: ${{ secrets.CODECOV_TOKEN }}
131131
files: ./.phpunit.cache/clover.xml

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
},
3232
"require-dev": {
3333
"behat/behat": "^3.14",
34-
"friendsofphp/php-cs-fixer": "^3.45",
34+
"friendsofphp/php-cs-fixer": "^3.68",
3535
"guzzlehttp/psr7": "^2",
3636
"php-mock/php-mock-phpunit": "^2.6",
37-
"phpstan/phpstan": "^1.10",
37+
"phpstan/phpstan": "^2.1",
3838
"phpunit/phpunit": "^9.5 || ^10.5"
3939
},
4040
"autoload": {

Diff for: phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
beStrictAboutCoverageMetadata="false"
88
beStrictAboutOutputDuringTests="true"
99
displayDetailsOnIncompleteTests="true"
10+
displayDetailsOnPhpunitDeprecations="true"
1011
displayDetailsOnSkippedTests="true"
1112
displayDetailsOnTestsThatTriggerDeprecations="true"
1213
displayDetailsOnTestsThatTriggerErrors="true"

Diff for: src/Redmine/Api/AbstractApi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class AbstractApi implements Api
4343
*/
4444
public function __construct($client)
4545
{
46-
if (! is_object($client) || (! $client instanceof Client && ! $client instanceof HttpClient)) {
46+
if (! $client instanceof Client && ! $client instanceof HttpClient) {
4747
throw new InvalidArgumentException(sprintf(
4848
'%s(): Argument #1 ($client) must be of type %s or %s, `%s` given',
4949
__METHOD__,

Diff for: src/Redmine/Client/Psr18Client.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ public function __construct(
4747
string $apikeyOrUsername,
4848
?string $password = null
4949
) {
50-
if (! $requestFactory instanceof RequestFactoryInterface && $requestFactory instanceof ServerRequestFactoryInterface) {
50+
if (! $requestFactory instanceof RequestFactoryInterface && ! $requestFactory instanceof ServerRequestFactoryInterface) {
51+
throw new Exception(sprintf(
52+
'%s(): Argument #2 ($requestFactory) must be of type %s',
53+
__METHOD__,
54+
RequestFactoryInterface::class,
55+
));
56+
}
57+
58+
if ($requestFactory instanceof ServerRequestFactoryInterface) {
5159
@trigger_error(
5260
sprintf(
5361
'%s(): Providing Argument #2 ($requestFactory) as %s is deprecated since v2.3.0, please provide as %s instead.',
@@ -61,14 +69,6 @@ public function __construct(
6169
$requestFactory = $this->handleServerRequestFactory($requestFactory);
6270
}
6371

64-
if (! $requestFactory instanceof RequestFactoryInterface) {
65-
throw new Exception(sprintf(
66-
'%s(): Argument #2 ($requestFactory) must be of type %s',
67-
__METHOD__,
68-
RequestFactoryInterface::class,
69-
));
70-
}
71-
7272
$this->httpClient = $httpClient;
7373
$this->requestFactory = $requestFactory;
7474
$this->streamFactory = $streamFactory;

Diff for: tests/Integration/Psr18ClientRequestGenerationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testPsr18ClientCreatesCorrectRequests(
3535
): void {
3636
$response = $this->createMock(ResponseInterface::class);
3737

38-
/** @var ClientInterface|\PHPUnit\Framework\MockObject\MockObject */
38+
/** @var ClientInterface&\PHPUnit\Framework\MockObject\MockObject */
3939
$httpClient = $this->createMock(ClientInterface::class);
4040
$httpClient->method('sendRequest')->willReturnCallback(function ($request) use ($response, $expectedOutput) {
4141
// Create a text representation of the HTTP request

Diff for: tests/Unit/Client/NativeCurlClient/RequestTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $
5050
'access_token',
5151
);
5252

53-
/** @var Request|\PHPUnit\Framework\MockObject\MockObject */
53+
/** @var Request&\PHPUnit\Framework\MockObject\MockObject */
5454
$request = $this->createConfiguredMock(Request::class, [
5555
'getMethod' => $method,
5656
'getPath' => '/path',
@@ -137,7 +137,7 @@ function ($errno, $errstr): bool {
137137
E_USER_DEPRECATED,
138138
);
139139

140-
/** @var Request|\PHPUnit\Framework\MockObject\MockObject */
140+
/** @var Request&\PHPUnit\Framework\MockObject\MockObject */
141141
$request = $this->createConfiguredMock(Request::class, [
142142
'getMethod' => 'POST',
143143
'getPath' => '/uploads.json',

0 commit comments

Comments
 (0)