Skip to content

Commit

Permalink
Merge pull request #439 from Art4/update-libraries
Browse files Browse the repository at this point in the history
Update libraries
  • Loading branch information
Art4 authored Jan 21, 2025
2 parents 2bcffdd + 1918ec5 commit c94d01b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:

- name: Upload coverage reports to Codecov
if: ${{ matrix.tool == 'code-coverage' }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.phpunit.cache/clover.xml
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
},
"require-dev": {
"behat/behat": "^3.14",
"friendsofphp/php-cs-fixer": "^3.45",
"friendsofphp/php-cs-fixer": "^3.68",
"guzzlehttp/psr7": "^2",
"php-mock/php-mock-phpunit": "^2.6",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^9.5 || ^10.5"
},
"autoload": {
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
Expand Down
2 changes: 1 addition & 1 deletion src/Redmine/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class AbstractApi implements Api
*/
public function __construct($client)
{
if (! is_object($client) || (! $client instanceof Client && ! $client instanceof HttpClient)) {
if (! $client instanceof Client && ! $client instanceof HttpClient) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($client) must be of type %s or %s, `%s` given',
__METHOD__,
Expand Down
18 changes: 9 additions & 9 deletions src/Redmine/Client/Psr18Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ public function __construct(
string $apikeyOrUsername,
?string $password = null
) {
if (! $requestFactory instanceof RequestFactoryInterface && $requestFactory instanceof ServerRequestFactoryInterface) {
if (! $requestFactory instanceof RequestFactoryInterface && ! $requestFactory instanceof ServerRequestFactoryInterface) {
throw new Exception(sprintf(
'%s(): Argument #2 ($requestFactory) must be of type %s',
__METHOD__,
RequestFactoryInterface::class,
));
}

if ($requestFactory instanceof ServerRequestFactoryInterface) {
@trigger_error(
sprintf(
'%s(): Providing Argument #2 ($requestFactory) as %s is deprecated since v2.3.0, please provide as %s instead.',
Expand All @@ -61,14 +69,6 @@ public function __construct(
$requestFactory = $this->handleServerRequestFactory($requestFactory);
}

if (! $requestFactory instanceof RequestFactoryInterface) {
throw new Exception(sprintf(
'%s(): Argument #2 ($requestFactory) must be of type %s',
__METHOD__,
RequestFactoryInterface::class,
));
}

$this->httpClient = $httpClient;
$this->requestFactory = $requestFactory;
$this->streamFactory = $streamFactory;
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Psr18ClientRequestGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testPsr18ClientCreatesCorrectRequests(
): void {
$response = $this->createMock(ResponseInterface::class);

/** @var ClientInterface|\PHPUnit\Framework\MockObject\MockObject */
/** @var ClientInterface&\PHPUnit\Framework\MockObject\MockObject */
$httpClient = $this->createMock(ClientInterface::class);
$httpClient->method('sendRequest')->willReturnCallback(function ($request) use ($response, $expectedOutput) {
// Create a text representation of the HTTP request
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Client/NativeCurlClient/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $
'access_token',
);

/** @var Request|\PHPUnit\Framework\MockObject\MockObject */
/** @var Request&\PHPUnit\Framework\MockObject\MockObject */
$request = $this->createConfiguredMock(Request::class, [
'getMethod' => $method,
'getPath' => '/path',
Expand Down Expand Up @@ -137,7 +137,7 @@ function ($errno, $errstr): bool {
E_USER_DEPRECATED,
);

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

0 comments on commit c94d01b

Please sign in to comment.