From dd56e4c888250619a62a55f751db41ff9151c5e8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 10 Jul 2024 08:51:02 +0200 Subject: [PATCH 1/9] Run PHP-CS-Fixer with ruleset PHPUnit84Migration:risky --- .php-cs-fixer.php | 1 + tests/Unit/Api/CustomFieldTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 3d1186f5..68201b26 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -11,6 +11,7 @@ return $config->setRules([ '@PER-CS2.0' => true, '@PER-CS2.0:risky' => true, + '@PHPUnit84Migration:risky' => true, 'array_syntax' => ['syntax' => 'short'], 'linebreak_after_opening_tag' => true, 'ordered_imports' => true, diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index 0e8d22cc..f7a6271d 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -178,7 +178,7 @@ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() // Perform the tests $retrievedDataSet = $api->all($allParameters); - $this->assertTrue(is_array($retrievedDataSet)); + $this->assertIsArray($retrievedDataSet); $this->assertArrayHasKey('limit', $retrievedDataSet); $this->assertArrayHasKey('items', $retrievedDataSet); } From e069bf527772effa2dedc25e99a1de800921f6bd Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 10 Jul 2024 08:52:33 +0200 Subject: [PATCH 2/9] Run PHP-CS-Fixer with ruleset PHPUnit100Migration:risky --- .php-cs-fixer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 68201b26..2ee53571 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -11,7 +11,7 @@ return $config->setRules([ '@PER-CS2.0' => true, '@PER-CS2.0:risky' => true, - '@PHPUnit84Migration:risky' => true, + '@PHPUnit100Migration:risky' => true, 'array_syntax' => ['syntax' => 'short'], 'linebreak_after_opening_tag' => true, 'ordered_imports' => true, From 01f5fe573cbbbfc7ee96b83fab2399b90da1a8c2 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 10 Jul 2024 09:29:56 +0200 Subject: [PATCH 3/9] add void return type in tests --- tests/Integration/IssueCategoryXmlTest.php | 2 +- .../Psr18ClientRequestGenerationTest.php | 2 +- tests/Integration/UrlTest.php | 38 +++++++++---------- tests/Integration/UserXmlTest.php | 2 +- tests/Unit/Api/AbstractApi/DeleteTest.php | 4 +- tests/Unit/Api/AbstractApi/GetTest.php | 6 +-- tests/Unit/Api/AbstractApi/PostTest.php | 4 +- tests/Unit/Api/AbstractApi/PutTest.php | 4 +- tests/Unit/Api/AbstractApiTest.php | 32 ++++++++-------- tests/Unit/Api/Attachment/DownloadTest.php | 2 +- tests/Unit/Api/Attachment/RemoveTest.php | 2 +- tests/Unit/Api/Attachment/ShowTest.php | 2 +- tests/Unit/Api/Attachment/UpdateTest.php | 4 +- tests/Unit/Api/Attachment/UploadTest.php | 2 +- tests/Unit/Api/AttachmentTest.php | 2 +- tests/Unit/Api/CustomField/ListNamesTest.php | 4 +- tests/Unit/Api/CustomField/ListTest.php | 10 ++--- tests/Unit/Api/CustomFieldTest.php | 22 +++++------ tests/Unit/Api/Group/AddUserTest.php | 4 +- tests/Unit/Api/Group/CreateTest.php | 6 +-- tests/Unit/Api/Group/ListNamesTest.php | 4 +- tests/Unit/Api/Group/ListTest.php | 6 +-- tests/Unit/Api/Group/RemoveTest.php | 2 +- tests/Unit/Api/Group/RemoveUserTest.php | 2 +- tests/Unit/Api/Group/ShowTest.php | 2 +- tests/Unit/Api/Group/UpdateTest.php | 2 +- tests/Unit/Api/GroupTest.php | 14 +++---- tests/Unit/Api/Issue/AddNoteToIssueTest.php | 2 +- tests/Unit/Api/Issue/AddWatcherTest.php | 4 +- tests/Unit/Api/Issue/AttachManyTest.php | 2 +- tests/Unit/Api/Issue/AttachTest.php | 2 +- tests/Unit/Api/Issue/CreateTest.php | 16 ++++---- tests/Unit/Api/Issue/ListTest.php | 6 +-- tests/Unit/Api/Issue/RemoveTest.php | 2 +- tests/Unit/Api/Issue/RemoveWatcherTest.php | 2 +- tests/Unit/Api/Issue/SetIssueStatusTest.php | 2 +- tests/Unit/Api/Issue/ShowTest.php | 2 +- tests/Unit/Api/Issue/UpdateTest.php | 4 +- tests/Unit/Api/IssueCategory/CreateTest.php | 8 ++-- .../Api/IssueCategory/ListByProjectTest.php | 8 ++-- .../IssueCategory/ListNamesByProjectTest.php | 6 +-- tests/Unit/Api/IssueCategory/RemoveTest.php | 2 +- tests/Unit/Api/IssueCategory/ShowTest.php | 2 +- tests/Unit/Api/IssueCategory/UpdateTest.php | 2 +- tests/Unit/Api/IssueCategoryTest.php | 18 ++++----- tests/Unit/Api/IssuePriority/ListTest.php | 6 +-- tests/Unit/Api/IssuePriorityTest.php | 6 +-- tests/Unit/Api/IssueRelation/CreateTest.php | 8 ++-- .../Api/IssueRelation/ListByIssueIdTest.php | 6 +-- tests/Unit/Api/IssueRelation/RemoveTest.php | 2 +- tests/Unit/Api/IssueRelation/ShowTest.php | 2 +- tests/Unit/Api/IssueRelationTest.php | 6 +-- tests/Unit/Api/IssueStatus/ListNamesTest.php | 4 +- tests/Unit/Api/IssueStatus/ListTest.php | 6 +-- tests/Unit/Api/IssueStatusTest.php | 18 ++++----- tests/Unit/Api/IssueTest.php | 10 ++--- tests/Unit/Api/Membership/CreateTest.php | 8 ++-- .../Unit/Api/Membership/ListByProjectTest.php | 8 ++-- .../Unit/Api/Membership/RemoveMemberTest.php | 6 +-- tests/Unit/Api/Membership/RemoveTest.php | 2 +- tests/Unit/Api/Membership/UpdateTest.php | 8 ++-- tests/Unit/Api/MembershipTest.php | 6 +-- tests/Unit/Api/News/ListByProjectTest.php | 8 ++-- tests/Unit/Api/News/ListTest.php | 6 +-- tests/Unit/Api/NewsTest.php | 8 ++-- tests/Unit/Api/Project/ArchiveTest.php | 6 +-- tests/Unit/Api/Project/CloseTest.php | 6 +-- tests/Unit/Api/Project/CreateTest.php | 8 ++-- tests/Unit/Api/Project/ListNamesTest.php | 6 +-- tests/Unit/Api/Project/ListTest.php | 6 +-- tests/Unit/Api/Project/RemoveTest.php | 2 +- tests/Unit/Api/Project/ReopenTest.php | 6 +-- tests/Unit/Api/Project/ShowTest.php | 2 +- tests/Unit/Api/Project/UnarchiveTest.php | 6 +-- tests/Unit/Api/Project/UpdateTest.php | 2 +- tests/Unit/Api/ProjectTest.php | 20 +++++----- tests/Unit/Api/Query/ListTest.php | 6 +-- tests/Unit/Api/QueryTest.php | 6 +-- tests/Unit/Api/Role/ListNamesTest.php | 4 +- tests/Unit/Api/Role/ListTest.php | 6 +-- tests/Unit/Api/Role/ShowTest.php | 2 +- tests/Unit/Api/RoleTest.php | 14 +++---- tests/Unit/Api/Search/ListByQueryTest.php | 6 +-- tests/Unit/Api/Search/SearchTest.php | 6 +-- tests/Unit/Api/TimeEntry/CreateTest.php | 8 ++-- tests/Unit/Api/TimeEntry/ListTest.php | 6 +-- tests/Unit/Api/TimeEntry/RemoveTest.php | 2 +- tests/Unit/Api/TimeEntry/ShowTest.php | 2 +- tests/Unit/Api/TimeEntry/UpdateTest.php | 2 +- .../Api/TimeEntryActivity/ListNamesTest.php | 4 +- tests/Unit/Api/TimeEntryActivity/ListTest.php | 6 +-- tests/Unit/Api/TimeEntryActivityTest.php | 16 ++++---- tests/Unit/Api/TimeEntryTest.php | 6 +-- tests/Unit/Api/Tracker/ListNamesTest.php | 4 +- tests/Unit/Api/Tracker/ListTest.php | 6 +-- tests/Unit/Api/TrackerTest.php | 18 ++++----- tests/Unit/Api/User/CreateTest.php | 8 ++-- tests/Unit/Api/User/ListLoginsTest.php | 6 +-- tests/Unit/Api/User/ListTest.php | 6 +-- tests/Unit/Api/User/RemoveTest.php | 2 +- tests/Unit/Api/User/ShowTest.php | 2 +- tests/Unit/Api/User/UpdateTest.php | 2 +- tests/Unit/Api/UserTest.php | 20 +++++----- tests/Unit/Api/Version/CreateTest.php | 10 ++--- tests/Unit/Api/Version/ListByProjectTest.php | 8 ++-- .../Api/Version/ListNamesByProjectTest.php | 6 +-- tests/Unit/Api/Version/RemoveTest.php | 2 +- tests/Unit/Api/Version/ShowTest.php | 2 +- tests/Unit/Api/Version/UpdateTest.php | 6 +-- tests/Unit/Api/VersionTest.php | 22 +++++------ tests/Unit/Api/Wiki/CreateTest.php | 2 +- tests/Unit/Api/Wiki/ListByProjectTest.php | 8 ++-- tests/Unit/Api/Wiki/RemoveTest.php | 2 +- tests/Unit/Api/Wiki/ShowTest.php | 2 +- tests/Unit/Api/Wiki/UpdateTest.php | 2 +- tests/Unit/Api/WikiTest.php | 6 +-- .../Client/NativeCurlClient/RequestTest.php | 4 +- tests/Unit/Client/NativeCurlClientTest.php | 38 +++++++++---------- tests/Unit/Client/Psr18Client/RequestTest.php | 4 +- tests/Unit/Client/Psr18ClientTest.php | 24 ++++++------ tests/Unit/Exception/ClientExceptionTest.php | 2 +- .../Exception/InvalidApiNameExceptionTest.php | 2 +- .../InvalidParameterExceptionTest.php | 2 +- .../MissingParameterExceptionTest.php | 2 +- .../UnexpectedResponseExceptionTest.php | 6 +-- .../Http/HttpFactory/MakeJsonRequestTest.php | 2 +- .../Unit/Http/HttpFactory/MakeRequestTest.php | 2 +- .../Http/HttpFactory/MakeResponseTest.php | 2 +- .../Http/HttpFactory/MakeXmlRequestTest.php | 2 +- tests/Unit/Serializer/JsonSerializerTest.php | 8 ++-- tests/Unit/Serializer/PathSerializerTest.php | 2 +- tests/Unit/Serializer/XmlSerializerTest.php | 8 ++-- 132 files changed, 422 insertions(+), 422 deletions(-) diff --git a/tests/Integration/IssueCategoryXmlTest.php b/tests/Integration/IssueCategoryXmlTest.php index 43ef43da..9b67f1a1 100644 --- a/tests/Integration/IssueCategoryXmlTest.php +++ b/tests/Integration/IssueCategoryXmlTest.php @@ -8,7 +8,7 @@ class IssueCategoryXmlTest extends TestCase { - public function testCreateBlank() + public function testCreateBlank(): void { /** @var \Redmine\Api\IssueCategory */ $api = MockClient::create()->getApi('issue_category'); diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index e084c623..c98edbe6 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -32,7 +32,7 @@ public function testPsr18ClientCreatesCorrectRequests( string $path, $data, $expectedOutput - ) { + ): void { $response = $this->createMock(ResponseInterface::class); /** @var ClientInterface|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/tests/Integration/UrlTest.php b/tests/Integration/UrlTest.php index 4d04ceb0..c799805a 100644 --- a/tests/Integration/UrlTest.php +++ b/tests/Integration/UrlTest.php @@ -7,7 +7,7 @@ class UrlTest extends TestCase { - public function testAttachment() + public function testAttachment(): void { /** @var \Redmine\Api\Attachment */ $api = MockClient::create()->getApi('attachment'); @@ -17,7 +17,7 @@ public function testAttachment() $this->assertEquals('GET', $res['method']); } - public function testCustomFields() + public function testCustomFields(): void { /** @var \Redmine\Api\CustomField */ $api = MockClient::create()->getApi('custom_fields'); @@ -27,7 +27,7 @@ public function testCustomFields() $this->assertEquals('GET', $res['method']); } - public function testGroup() + public function testGroup(): void { /** @var \Redmine\Api\Group */ $api = MockClient::create()->getApi('group'); @@ -55,7 +55,7 @@ public function testGroup() $this->assertEquals('DELETE', $res['method']); } - public function testIssue() + public function testIssue(): void { /** @var \Redmine\Api\Issue */ $api = MockClient::create()->getApi('issue'); @@ -85,7 +85,7 @@ public function testIssue() // $this->assertEquals($res, array('path' => '/issues/1.xml', 'method' => 'DELETE')); } - public function testIssueCategory() + public function testIssueCategory(): void { /** @var \Redmine\Api\IssueCategory */ $api = MockClient::create()->getApi('issue_category'); @@ -113,7 +113,7 @@ public function testIssueCategory() $this->assertEquals('DELETE', $res['method']); } - public function testIssuePriority() + public function testIssuePriority(): void { /** @var \Redmine\Api\IssuePriority */ $api = MockClient::create()->getApi('issue_priority'); @@ -123,7 +123,7 @@ public function testIssuePriority() $this->assertEquals('GET', $res['method']); } - public function testIssueRelation() + public function testIssueRelation(): void { /** @var \Redmine\Api\IssueRelation */ $api = MockClient::create()->getApi('issue_relation'); @@ -142,7 +142,7 @@ public function testIssueRelation() $this->assertEquals('DELETE', $res['method']); } - public function testIssueStatus() + public function testIssueStatus(): void { /** @var \Redmine\Api\IssueStatus */ $api = MockClient::create()->getApi('issue_status'); @@ -152,7 +152,7 @@ public function testIssueStatus() $this->assertEquals('GET', $res['method']); } - public function testMembership() + public function testMembership(): void { /** @var \Redmine\Api\Membership */ $api = MockClient::create()->getApi('membership'); @@ -169,7 +169,7 @@ public function testMembership() $this->assertEquals('DELETE', $res['method']); } - public function testNews() + public function testNews(): void { /** @var \Redmine\Api\News */ $api = MockClient::create()->getApi('news'); @@ -184,7 +184,7 @@ public function testNews() $this->assertEquals('GET', $res['method']); } - public function testProject() + public function testProject(): void { /** @var \Redmine\Api\Project */ $api = MockClient::create()->getApi('project'); @@ -206,7 +206,7 @@ public function testProject() $this->assertEquals('DELETE', $res['method']); } - public function testQuery() + public function testQuery(): void { /** @var \Redmine\Api\Query */ $api = MockClient::create()->getApi('query'); @@ -216,7 +216,7 @@ public function testQuery() $this->assertEquals('GET', $res['method']); } - public function testRole() + public function testRole(): void { /** @var \Redmine\Api\Role */ $api = MockClient::create()->getApi('role'); @@ -231,7 +231,7 @@ public function testRole() $this->assertEquals('GET', $res['method']); } - public function testTimeEntry() + public function testTimeEntry(): void { /** @var \Redmine\Api\TimeEntry */ $api = MockClient::create()->getApi('time_entry'); @@ -267,7 +267,7 @@ public function testTimeEntry() $this->assertEquals('DELETE', $res['method']); } - public function testTimeEntryActivity() + public function testTimeEntryActivity(): void { /** @var \Redmine\Api\TimeEntryActivity */ $api = MockClient::create()->getApi('time_entry_activity'); @@ -277,7 +277,7 @@ public function testTimeEntryActivity() $this->assertEquals('GET', $res['method']); } - public function testTracker() + public function testTracker(): void { /** @var \Redmine\Api\Tracker */ $api = MockClient::create()->getApi('tracker'); @@ -287,7 +287,7 @@ public function testTracker() $this->assertEquals('GET', $res['method']); } - public function testUser() + public function testUser(): void { /** @var \Redmine\Api\User */ $api = MockClient::create()->getApi('user'); @@ -324,7 +324,7 @@ public function testUser() $this->assertEquals('DELETE', $res['method']); } - public function testVersion() + public function testVersion(): void { /** @var \Redmine\Api\Version */ $api = MockClient::create()->getApi('version'); @@ -346,7 +346,7 @@ public function testVersion() $this->assertEquals('DELETE', $res['method']); } - public function testWiki() + public function testWiki(): void { /** @var \Redmine\Api\Wiki */ $api = MockClient::create()->getApi('wiki'); diff --git a/tests/Integration/UserXmlTest.php b/tests/Integration/UserXmlTest.php index 46849730..ea17370c 100644 --- a/tests/Integration/UserXmlTest.php +++ b/tests/Integration/UserXmlTest.php @@ -8,7 +8,7 @@ class UserXmlTest extends TestCase { - public function testCreateBlank() + public function testCreateBlank(): void { /** @var \Redmine\Api\User */ $api = MockClient::create()->getApi('user'); diff --git a/tests/Unit/Api/AbstractApi/DeleteTest.php b/tests/Unit/Api/AbstractApi/DeleteTest.php index a3136e4a..9df99358 100644 --- a/tests/Unit/Api/AbstractApi/DeleteTest.php +++ b/tests/Unit/Api/AbstractApi/DeleteTest.php @@ -15,7 +15,7 @@ #[CoversClass(AbstractApi::class)] class DeleteTest extends TestCase { - public function testDeleteWithHttpClient() + public function testDeleteWithHttpClient(): void { $client = AssertingHttpClient::create( $this, @@ -45,7 +45,7 @@ public function testDeleteWithHttpClient() * @dataProvider getXmlDecodingFromDeleteMethodData */ #[DataProvider('getXmlDecodingFromDeleteMethodData')] - public function testXmlDecodingFromDeleteMethod($response, $expected) + public function testXmlDecodingFromDeleteMethod($response, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/GetTest.php b/tests/Unit/Api/AbstractApi/GetTest.php index 211e62cb..3cf31e25 100644 --- a/tests/Unit/Api/AbstractApi/GetTest.php +++ b/tests/Unit/Api/AbstractApi/GetTest.php @@ -16,7 +16,7 @@ #[CoversClass(AbstractApi::class)] class GetTest extends TestCase { - public function testGetWithHttpClient() + public function testGetWithHttpClient(): void { $client = AssertingHttpClient::create( $this, @@ -47,7 +47,7 @@ public function testGetWithHttpClient() * @dataProvider getJsonDecodingFromGetMethodData */ #[DataProvider('getJsonDecodingFromGetMethodData')] - public function testJsonDecodingFromGetMethod($response, $decode, $expected) + public function testJsonDecodingFromGetMethod($response, $decode, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); @@ -82,7 +82,7 @@ public static function getJsonDecodingFromGetMethodData(): array * @dataProvider getXmlDecodingFromGetMethodData */ #[DataProvider('getXmlDecodingFromGetMethodData')] - public function testXmlDecodingFromGetMethod($response, $decode, $expected) + public function testXmlDecodingFromGetMethod($response, $decode, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/PostTest.php b/tests/Unit/Api/AbstractApi/PostTest.php index 0d25fb96..d9b351af 100644 --- a/tests/Unit/Api/AbstractApi/PostTest.php +++ b/tests/Unit/Api/AbstractApi/PostTest.php @@ -16,7 +16,7 @@ #[CoversClass(AbstractApi::class)] class PostTest extends TestCase { - public function testPostWithHttpClient() + public function testPostWithHttpClient(): void { $client = AssertingHttpClient::create( $this, @@ -47,7 +47,7 @@ public function testPostWithHttpClient() * @dataProvider getXmlDecodingFromPostMethodData */ #[DataProvider('getXmlDecodingFromPostMethodData')] - public function testXmlDecodingFromPostMethod($response, $expected) + public function testXmlDecodingFromPostMethod($response, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/PutTest.php b/tests/Unit/Api/AbstractApi/PutTest.php index ff78c11e..9e262bd6 100644 --- a/tests/Unit/Api/AbstractApi/PutTest.php +++ b/tests/Unit/Api/AbstractApi/PutTest.php @@ -16,7 +16,7 @@ #[CoversClass(AbstractApi::class)] class PutTest extends TestCase { - public function testPutWithHttpClient() + public function testPutWithHttpClient(): void { $client = AssertingHttpClient::create( $this, @@ -47,7 +47,7 @@ public function testPutWithHttpClient() * @dataProvider getXmlDecodingFromPutMethodData */ #[DataProvider('getXmlDecodingFromPutMethodData')] - public function testXmlDecodingFromPutMethod($response, $expected) + public function testXmlDecodingFromPutMethod($response, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApiTest.php b/tests/Unit/Api/AbstractApiTest.php index 6d8c75c0..cc0fc68c 100644 --- a/tests/Unit/Api/AbstractApiTest.php +++ b/tests/Unit/Api/AbstractApiTest.php @@ -18,7 +18,7 @@ #[CoversClass(AbstractApi::class)] class AbstractApiTest extends TestCase { - public function testCreateWithHttpClientWorks() + public function testCreateWithHttpClientWorks(): void { $client = $this->createMock(HttpClient::class); @@ -30,7 +30,7 @@ public function testCreateWithHttpClientWorks() $this->assertSame($client, $method->invoke($api)); } - public function testCreateWitClientWorks() + public function testCreateWitClientWorks(): void { $client = $this->createMock(Client::class); @@ -42,7 +42,7 @@ public function testCreateWitClientWorks() $this->assertInstanceOf(HttpClient::class, $method->invoke($api)); } - public function testCreateWithoutClitentOrHttpClientThrowsException() + public function testCreateWithoutClitentOrHttpClientThrowsException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Redmine\Api\AbstractApi::__construct(): Argument #1 ($client) must be of type Redmine\Client\Client or Redmine\Http\HttpClient, `stdClass` given'); @@ -51,7 +51,7 @@ public function testCreateWithoutClitentOrHttpClientThrowsException() new class (new \stdClass()) extends AbstractApi {}; } - public function testGetTriggersDeprecationWarning() + public function testGetTriggersDeprecationWarning(): void { $client = $this->createMock(HttpClient::class); @@ -79,7 +79,7 @@ function ($errno, $errstr): bool { $api->runGet('/path.json'); } - public function testGetLastResponseWithHttpClientWorks() + public function testGetLastResponseWithHttpClientWorks(): void { $client = $this->createMock(HttpClient::class); @@ -88,7 +88,7 @@ public function testGetLastResponseWithHttpClientWorks() $this->assertInstanceOf(Response::class, $api->getLastResponse()); } - public function testPostTriggersDeprecationWarning() + public function testPostTriggersDeprecationWarning(): void { $client = $this->createMock(HttpClient::class); @@ -116,7 +116,7 @@ function ($errno, $errstr): bool { $api->runPost('/path.json', 'data'); } - public function testPutTriggersDeprecationWarning() + public function testPutTriggersDeprecationWarning(): void { $client = $this->createMock(HttpClient::class); @@ -144,7 +144,7 @@ function ($errno, $errstr): bool { $api->runPut('/path.json', 'data'); } - public function testDeleteTriggersDeprecationWarning() + public function testDeleteTriggersDeprecationWarning(): void { $client = $this->createMock(HttpClient::class); @@ -176,7 +176,7 @@ function ($errno, $errstr): bool { * @dataProvider getIsNotNullReturnsCorrectBooleanData */ #[DataProvider('getIsNotNullReturnsCorrectBooleanData')] - public function testIsNotNullReturnsCorrectBoolean(bool $expected, $value) + public function testIsNotNullReturnsCorrectBoolean(bool $expected, $value): void { $client = $this->createMock(Client::class); @@ -210,7 +210,7 @@ public static function getIsNotNullReturnsCorrectBooleanData(): array ]; } - public function testLastCallFailedPreventsRaceCondition() + public function testLastCallFailedPreventsRaceCondition(): void { $client = AssertingHttpClient::create( $this, @@ -257,7 +257,7 @@ public function __construct($client) * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] - public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $expectedBoolean) + public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $expectedBoolean): void { $client = $this->createMock(Client::class); $client->method('getLastResponseStatusCode')->willReturn($statusCode); @@ -271,7 +271,7 @@ public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $ * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] - public function testLastCallFailedWithHttpClientReturnsCorrectBoolean($statusCode, $expectedBoolean) + public function testLastCallFailedWithHttpClientReturnsCorrectBoolean($statusCode, $expectedBoolean): void { $response = $this->createMock(Response::class); $response->method('getStatusCode')->willReturn($statusCode); @@ -365,7 +365,7 @@ public static function getLastCallFailedData(): array * @dataProvider retrieveDataData */ #[DataProvider('retrieveDataData')] - public function testRetrieveData($path, $contentType, $response, $expected) + public function testRetrieveData($path, $contentType, $response, $expected): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); @@ -402,7 +402,7 @@ public static function retrieveDataData(): array * @dataProvider getRetrieveDataToExceptionData */ #[DataProvider('getRetrieveDataToExceptionData')] - public function testRetrieveDataThrowsException($response, $contentType, $expectedException, $expectedMessage) + public function testRetrieveDataThrowsException($response, $contentType, $expectedException, $expectedMessage): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); @@ -431,7 +431,7 @@ public static function getRetrieveDataToExceptionData(): array * @dataProvider getRetrieveAllData */ #[DataProvider('getRetrieveAllData')] - public function testDeprecatedRetrieveAll($content, $contentType, $expected) + public function testDeprecatedRetrieveAll($content, $contentType, $expected): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); @@ -455,7 +455,7 @@ public static function getRetrieveAllData(): array ]; } - public function testDeprecatedAttachCustomFieldXML() + public function testDeprecatedAttachCustomFieldXML(): void { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Attachment/DownloadTest.php b/tests/Unit/Api/Attachment/DownloadTest.php index eab6a69e..cb3ab759 100644 --- a/tests/Unit/Api/Attachment/DownloadTest.php +++ b/tests/Unit/Api/Attachment/DownloadTest.php @@ -15,7 +15,7 @@ class DownloadTest extends TestCase * @dataProvider getDownloadData */ #[DataProvider('getDownloadData')] - public function testDownloadReturnsCorrectResponse($id, $expectedPath, $responseCode, $response, $expectedReturn) + public function testDownloadReturnsCorrectResponse($id, $expectedPath, $responseCode, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/RemoveTest.php b/tests/Unit/Api/Attachment/RemoveTest.php index 4009fa7b..0f21a33c 100644 --- a/tests/Unit/Api/Attachment/RemoveTest.php +++ b/tests/Unit/Api/Attachment/RemoveTest.php @@ -12,7 +12,7 @@ #[CoversClass(Attachment::class)] class RemoveTest extends TestCase { - public function testRemoveReturnsString() + public function testRemoveReturnsString(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/ShowTest.php b/tests/Unit/Api/Attachment/ShowTest.php index d47c73b5..37315559 100644 --- a/tests/Unit/Api/Attachment/ShowTest.php +++ b/tests/Unit/Api/Attachment/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/UpdateTest.php b/tests/Unit/Api/Attachment/UpdateTest.php index 96b9728d..8fd28190 100644 --- a/tests/Unit/Api/Attachment/UpdateTest.php +++ b/tests/Unit/Api/Attachment/UpdateTest.php @@ -16,7 +16,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, array $params, $expectedPath, $expectedContent, $expectedReturn) + public function testUpdateReturnsCorrectResponse($id, array $params, $expectedPath, $expectedContent, $expectedReturn): void { $client = AssertingHttpClient::create( $this, @@ -54,7 +54,7 @@ public static function getUpdateData(): array ]; } - public function testUpdateThrowsUnexpectedResponseException() + public function testUpdateThrowsUnexpectedResponseException(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/UploadTest.php b/tests/Unit/Api/Attachment/UploadTest.php index 5bfe5378..a86d9a0a 100644 --- a/tests/Unit/Api/Attachment/UploadTest.php +++ b/tests/Unit/Api/Attachment/UploadTest.php @@ -15,7 +15,7 @@ class UploadTest extends TestCase * @dataProvider getUploadData */ #[DataProvider('getUploadData')] - public function testUploadReturnsCorrectResponse($attachment, $params, $expectedAttachment, $expectedPath, $responseCode, $response, $expectedReturn) + public function testUploadReturnsCorrectResponse($attachment, $params, $expectedAttachment, $expectedPath, $responseCode, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index 321950ba..a8f58fb3 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -23,7 +23,7 @@ class AttachmentTest extends TestCase * @param bool $hasFailed */ #[DataProvider('responseCodeProvider')] - public function testLastCallFailedTrue($responseCode, $hasFailed) + public function testLastCallFailedTrue($responseCode, $hasFailed): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/CustomField/ListNamesTest.php b/tests/Unit/Api/CustomField/ListNamesTest.php index a79e17c8..66c94041 100644 --- a/tests/Unit/Api/CustomField/ListNamesTest.php +++ b/tests/Unit/Api/CustomField/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/CustomField/ListTest.php b/tests/Unit/Api/CustomField/ListTest.php index a5da8fce..4498144e 100644 --- a/tests/Unit/Api/CustomField/ListTest.php +++ b/tests/Unit/Api/CustomField/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(CustomField::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedResponse, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $allParameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedResponse, $api->list($allParameters)); } - public function testListWithHighLimitParametersReturnsResponse() + public function testListWithHighLimitParametersReturnsResponse(): void { // Test values $response = '{"limit":"100","items":[]}'; @@ -96,7 +96,7 @@ public function testListWithHighLimitParametersReturnsResponse() $this->assertSame($expectedResponse, $api->list($allParameters)); } - public function testListCallsEndpointUntilOffsetIsHigherThanTotalCount() + public function testListCallsEndpointUntilOffsetIsHigherThanTotalCount(): void { // Test values $response = '{"limit":"100","offset":"10","total_count":"5","items":[]}'; @@ -130,7 +130,7 @@ public function testListCallsEndpointUntilOffsetIsHigherThanTotalCount() $this->assertSame($returnDataSet, $api->list($allParameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index f7a6271d..a713a7f9 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -18,7 +18,7 @@ class CustomFieldTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new CustomField(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $allParameters = ['not-used']; @@ -111,7 +111,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test all(). */ - public function testAllReturnsClientGetResponseWithHighLimit() + public function testAllReturnsClientGetResponseWithHighLimit(): void { // Test values $response = '{"limit":"100","items":[]}'; @@ -146,7 +146,7 @@ public function testAllReturnsClientGetResponseWithHighLimit() /** * Test all(). */ - public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() + public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount(): void { // Test values $response = '{"limit":"100","offset":"10","total_count":"5","items":[]}'; @@ -186,7 +186,7 @@ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"custom_fields":[{"id":1,"name":"CustomField 1"},{"id":5,"name":"CustomField 5"}]}'; @@ -220,7 +220,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"custom_fields":[{"id":1,"name":"CustomField 1"},{"id":5,"name":"CustomField 5"}]}'; @@ -255,7 +255,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"custom_fields":[{"id":1,"name":"CustomField 1"},{"id":5,"name":"CustomField 5"}]}'; @@ -290,7 +290,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -322,7 +322,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"custom_fields":[{"id":5,"name":"CustomField 5"}]}'; @@ -350,7 +350,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName('CustomField 5')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/Group/AddUserTest.php b/tests/Unit/Api/Group/AddUserTest.php index 400af20f..7c85bfac 100644 --- a/tests/Unit/Api/Group/AddUserTest.php +++ b/tests/Unit/Api/Group/AddUserTest.php @@ -16,7 +16,7 @@ class AddUserTest extends TestCase * @dataProvider getAddUserData */ #[DataProvider('getAddUserData')] - public function testAddUserReturnsCorrectResponse($groupId, $userId, $expectedPath, $expectedBody, $responseCode, $response) + public function testAddUserReturnsCorrectResponse($groupId, $userId, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -58,7 +58,7 @@ public static function getAddUserData(): array ]; } - public function testAddUserReturnsEmptyString() + public function testAddUserReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/CreateTest.php b/tests/Unit/Api/Group/CreateTest.php index 65898abc..800f1158 100644 --- a/tests/Unit/Api/Group/CreateTest.php +++ b/tests/Unit/Api/Group/CreateTest.php @@ -20,7 +20,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -107,7 +107,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -131,7 +131,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionIfNameIsMissing() + public function testCreateThrowsExceptionIfNameIsMissing(): void { // Test values $postParameter = []; diff --git a/tests/Unit/Api/Group/ListNamesTest.php b/tests/Unit/Api/Group/ListNamesTest.php index 55c0d990..3d952784 100644 --- a/tests/Unit/Api/Group/ListNamesTest.php +++ b/tests/Unit/Api/Group/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/ListTest.php b/tests/Unit/Api/Group/ListTest.php index 6f9f403c..7d5c4d17 100644 --- a/tests/Unit/Api/Group/ListTest.php +++ b/tests/Unit/Api/Group/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Group::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListeWithParametersReturnsResponse() + public function testListeWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListeWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Group/RemoveTest.php b/tests/Unit/Api/Group/RemoveTest.php index 1a1851a2..d89205b8 100644 --- a/tests/Unit/Api/Group/RemoveTest.php +++ b/tests/Unit/Api/Group/RemoveTest.php @@ -12,7 +12,7 @@ #[CoversClass(Group::class)] class RemoveTest extends TestCase { - public function testRemoveReturnsString() + public function testRemoveReturnsString(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/RemoveUserTest.php b/tests/Unit/Api/Group/RemoveUserTest.php index fe73f361..fb9a94b4 100644 --- a/tests/Unit/Api/Group/RemoveUserTest.php +++ b/tests/Unit/Api/Group/RemoveUserTest.php @@ -12,7 +12,7 @@ #[CoversClass(Group::class)] class RemoveUserTest extends TestCase { - public function testRemoveUserReturnsString() + public function testRemoveUserReturnsString(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/ShowTest.php b/tests/Unit/Api/Group/ShowTest.php index 5bb23fd8..8bc8d12c 100644 --- a/tests/Unit/Api/Group/ShowTest.php +++ b/tests/Unit/Api/Group/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($groupId, array $params, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($groupId, array $params, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/UpdateTest.php b/tests/Unit/Api/Group/UpdateTest.php index d8847dbe..e22de63d 100644 --- a/tests/Unit/Api/Group/UpdateTest.php +++ b/tests/Unit/Api/Group/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/GroupTest.php b/tests/Unit/Api/GroupTest.php index 211d8064..f3f35973 100644 --- a/tests/Unit/Api/GroupTest.php +++ b/tests/Unit/Api/GroupTest.php @@ -20,7 +20,7 @@ class GroupTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Group(MockClient::create()); @@ -47,7 +47,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -81,7 +81,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; @@ -116,7 +116,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -148,7 +148,7 @@ function ($errno, $errstr): bool { /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"groups":[{"id":1,"name":"Group 1"},{"id":5,"name":"Group 5"}]}'; @@ -182,7 +182,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"groups":[{"id":1,"name":"Group 1"},{"id":5,"name":"Group 5"}]}'; @@ -217,7 +217,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"groups":[{"id":1,"name":"Group 1"},{"id":5,"name":"Group 5"}]}'; diff --git a/tests/Unit/Api/Issue/AddNoteToIssueTest.php b/tests/Unit/Api/Issue/AddNoteToIssueTest.php index 7932f6d3..771b3101 100644 --- a/tests/Unit/Api/Issue/AddNoteToIssueTest.php +++ b/tests/Unit/Api/Issue/AddNoteToIssueTest.php @@ -17,7 +17,7 @@ class AddNoteToIssueTest extends TestCase * @dataProvider getAddNoteToIssueData */ #[DataProvider('getAddNoteToIssueData')] - public function testAddNoteToIssueReturnsCorrectResponse($id, $note, $isPrivate, $expectedPath, $expectedBody, $responseCode, $response) + public function testAddNoteToIssueReturnsCorrectResponse($id, $note, $isPrivate, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AddWatcherTest.php b/tests/Unit/Api/Issue/AddWatcherTest.php index 0f51cd2f..26fbda1c 100644 --- a/tests/Unit/Api/Issue/AddWatcherTest.php +++ b/tests/Unit/Api/Issue/AddWatcherTest.php @@ -16,7 +16,7 @@ class AddWatcherTest extends TestCase * @dataProvider getAddWatcherData */ #[DataProvider('getAddWatcherData')] - public function testAddWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $expectedBody, $responseCode, $response) + public function testAddWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -58,7 +58,7 @@ public static function getAddWatcherData(): array ]; } - public function testAddWatcherReturnsEmptyString() + public function testAddWatcherReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AttachManyTest.php b/tests/Unit/Api/Issue/AttachManyTest.php index 1c77a767..038011ed 100644 --- a/tests/Unit/Api/Issue/AttachManyTest.php +++ b/tests/Unit/Api/Issue/AttachManyTest.php @@ -15,7 +15,7 @@ class AttachManyTest extends TestCase * @dataProvider getAttachManyData */ #[DataProvider('getAttachManyData')] - public function testAttachManyReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testAttachManyReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AttachTest.php b/tests/Unit/Api/Issue/AttachTest.php index 51263987..9cfce197 100644 --- a/tests/Unit/Api/Issue/AttachTest.php +++ b/tests/Unit/Api/Issue/AttachTest.php @@ -15,7 +15,7 @@ class AttachTest extends TestCase * @dataProvider getAttachData */ #[DataProvider('getAttachData')] - public function testAttachReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testAttachReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/CreateTest.php b/tests/Unit/Api/Issue/CreateTest.php index 4510d2d3..dd142481 100644 --- a/tests/Unit/Api/Issue/CreateTest.php +++ b/tests/Unit/Api/Issue/CreateTest.php @@ -16,7 +16,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -232,7 +232,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -256,7 +256,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateWithHttpClientRetrievesIssueStatusId() + public function testCreateWithHttpClientRetrievesIssueStatusId(): void { $client = AssertingHttpClient::create( $this, @@ -293,7 +293,7 @@ public function testCreateWithHttpClientRetrievesIssueStatusId() ); } - public function testCreateWithHttpClientRetrievesProjectId() + public function testCreateWithHttpClientRetrievesProjectId(): void { $client = AssertingHttpClient::create( $this, @@ -330,7 +330,7 @@ public function testCreateWithHttpClientRetrievesProjectId() ); } - public function testCreateWithHttpClientRetrievesIssueCategoryId() + public function testCreateWithHttpClientRetrievesIssueCategoryId(): void { $client = AssertingHttpClient::create( $this, @@ -367,7 +367,7 @@ public function testCreateWithHttpClientRetrievesIssueCategoryId() ); } - public function testCreateWithHttpClientRetrievesTrackerId() + public function testCreateWithHttpClientRetrievesTrackerId(): void { $client = AssertingHttpClient::create( $this, @@ -404,7 +404,7 @@ public function testCreateWithHttpClientRetrievesTrackerId() ); } - public function testCreateWithHttpClientRetrievesUserId() + public function testCreateWithHttpClientRetrievesUserId(): void { $client = AssertingHttpClient::create( $this, @@ -444,7 +444,7 @@ public function testCreateWithHttpClientRetrievesUserId() /** * Test cleanParams(). */ - public function testCreateWithClientCleansParameters() + public function testCreateWithClientCleansParameters(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/ListTest.php b/tests/Unit/Api/Issue/ListTest.php index ee3899ed..26637a84 100644 --- a/tests/Unit/Api/Issue/ListTest.php +++ b/tests/Unit/Api/Issue/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Issue::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Issue/RemoveTest.php b/tests/Unit/Api/Issue/RemoveTest.php index e57a24f5..cccf5b03 100644 --- a/tests/Unit/Api/Issue/RemoveTest.php +++ b/tests/Unit/Api/Issue/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/RemoveWatcherTest.php b/tests/Unit/Api/Issue/RemoveWatcherTest.php index 9124aa2e..1e8f9c4b 100644 --- a/tests/Unit/Api/Issue/RemoveWatcherTest.php +++ b/tests/Unit/Api/Issue/RemoveWatcherTest.php @@ -15,7 +15,7 @@ class RemoveWatcherTest extends TestCase * @dataProvider getRemoveWatcherData */ #[DataProvider('getRemoveWatcherData')] - public function testRemoveWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $responseCode, $response) + public function testRemoveWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/SetIssueStatusTest.php b/tests/Unit/Api/Issue/SetIssueStatusTest.php index 96d55bc6..a4439f64 100644 --- a/tests/Unit/Api/Issue/SetIssueStatusTest.php +++ b/tests/Unit/Api/Issue/SetIssueStatusTest.php @@ -10,7 +10,7 @@ #[CoversClass(Issue::class)] class SetIssueStatusTest extends TestCase { - public function testSetIssueStatusReturnsCorrectResponse() + public function testSetIssueStatusReturnsCorrectResponse(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/ShowTest.php b/tests/Unit/Api/Issue/ShowTest.php index 2846237f..45718e7a 100644 --- a/tests/Unit/Api/Issue/ShowTest.php +++ b/tests/Unit/Api/Issue/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($issueId, array $params, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($issueId, array $params, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/UpdateTest.php b/tests/Unit/Api/Issue/UpdateTest.php index 5a2e6da3..d30fb1b7 100644 --- a/tests/Unit/Api/Issue/UpdateTest.php +++ b/tests/Unit/Api/Issue/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -113,7 +113,7 @@ public static function getUpdateData(): array ]; } - public function testUpdateCleansParameters() + public function testUpdateCleansParameters(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/CreateTest.php b/tests/Unit/Api/IssueCategory/CreateTest.php index 4153f18f..5fe5365e 100644 --- a/tests/Unit/Api/IssueCategory/CreateTest.php +++ b/tests/Unit/Api/IssueCategory/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -97,7 +97,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -116,7 +116,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/IssueCategory/ListByProjectTest.php b/tests/Unit/Api/IssueCategory/ListByProjectTest.php index a3592ed1..356ec2ff 100644 --- a/tests/Unit/Api/IssueCategory/ListByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListByProjectTest.php @@ -15,7 +15,7 @@ #[CoversClass(IssueCategory::class)] class ListByProjectTest extends TestCase { - public function testListByProjectWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse(): void { // Test values $projectId = 5; @@ -42,7 +42,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByProject($projectId)); } - public function testListByProjectWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse(): void { // Test values $projectId = 'project-slug'; @@ -74,7 +74,7 @@ public function testListByProjectWithParametersReturnsResponse() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new IssueCategory(MockClient::create()); @@ -84,7 +84,7 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj $api->listByProject($projectIdentifier); } - public function testListByProjectThrowsException() + public function testListByProjectThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php b/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php index 3ec124d1..aae301c5 100644 --- a/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php @@ -21,7 +21,7 @@ class ListNamesByProjectTest extends TestCase * @dataProvider getListNamesByProjectData */ #[DataProvider('getListNamesByProjectData')] - public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -79,7 +79,7 @@ public static function getListNamesByProjectData(): array ]; } - public function testListNamesByProjectCallsHttpClientOnlyOnce() + public function testListNamesByProjectCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, @@ -116,7 +116,7 @@ public function testListNamesByProjectCallsHttpClientOnlyOnce() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListNamesByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListNamesByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new IssueCategory($this->createMock(HttpClient::class)); diff --git a/tests/Unit/Api/IssueCategory/RemoveTest.php b/tests/Unit/Api/IssueCategory/RemoveTest.php index 6150e240..f66d6e8f 100644 --- a/tests/Unit/Api/IssueCategory/RemoveTest.php +++ b/tests/Unit/Api/IssueCategory/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $params, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($issueId, $params, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/ShowTest.php b/tests/Unit/Api/IssueCategory/ShowTest.php index 472ba3be..e9e5c960 100644 --- a/tests/Unit/Api/IssueCategory/ShowTest.php +++ b/tests/Unit/Api/IssueCategory/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/UpdateTest.php b/tests/Unit/Api/IssueCategory/UpdateTest.php index 3c1f7015..c948ed67 100644 --- a/tests/Unit/Api/IssueCategory/UpdateTest.php +++ b/tests/Unit/Api/IssueCategory/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index 2bdbba84..0838502d 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -18,7 +18,7 @@ class IssueCategoryTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new IssueCategory(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllDAta */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void { // Test values $projectId = 5; @@ -82,7 +82,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $projectId = 5; @@ -118,7 +118,7 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"issue_categories":[{"id":1,"name":"IssueCategory 1"},{"id":5,"name":"IssueCategory 5"}]}'; @@ -152,7 +152,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"issue_categories":[{"id":1,"name":"IssueCategory 1"},{"id":5,"name":"IssueCategory 5"}]}'; @@ -187,7 +187,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"issue_categories":[{"id":1,"name":"IssueCategory 1"},{"id":5,"name":"IssueCategory 5"}]}'; @@ -222,7 +222,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -254,7 +254,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"issue_categories":[{"id":5,"name":"IssueCategory 5"}]}'; @@ -282,7 +282,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName(5, 'IssueCategory 5')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/IssuePriority/ListTest.php b/tests/Unit/Api/IssuePriority/ListTest.php index eb3c541b..81171687 100644 --- a/tests/Unit/Api/IssuePriority/ListTest.php +++ b/tests/Unit/Api/IssuePriority/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(IssuePriority::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $allParameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($allParameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssuePriorityTest.php b/tests/Unit/Api/IssuePriorityTest.php index 2ad4ed3c..bb07580f 100644 --- a/tests/Unit/Api/IssuePriorityTest.php +++ b/tests/Unit/Api/IssuePriorityTest.php @@ -18,7 +18,7 @@ class IssuePriorityTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new IssuePriority(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $allParameters = ['not-used']; diff --git a/tests/Unit/Api/IssueRelation/CreateTest.php b/tests/Unit/Api/IssueRelation/CreateTest.php index 3adf9327..d273fdc8 100644 --- a/tests/Unit/Api/IssueRelation/CreateTest.php +++ b/tests/Unit/Api/IssueRelation/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response, $expectedReturn) + public function testCreateReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, @@ -58,7 +58,7 @@ public static function getCreateData(): array ]; } - public function testCreateThrowsExceptionIfResponseContainsEmptyString() + public function testCreateThrowsExceptionIfResponseContainsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -83,7 +83,7 @@ public function testCreateThrowsExceptionIfResponseContainsEmptyString() $api->create(5, ['issue_to_id' => 10]); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -102,7 +102,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php index d230015f..ea06fa3a 100644 --- a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php +++ b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php @@ -11,7 +11,7 @@ #[CoversClass(IssueRelation::class)] class ListByIssueIdTest extends TestCase { - public function testListByIssueIdWithoutParametersReturnsResponse() + public function testListByIssueIdWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListByIssueIdWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByIssueId(5)); } - public function testListByIssueIdWithParametersReturnsResponse() + public function testListByIssueIdWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListByIssueIdWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByIssueId(5, $parameters)); } - public function testListByIssueIdThrowsException() + public function testListByIssueIdThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueRelation/RemoveTest.php b/tests/Unit/Api/IssueRelation/RemoveTest.php index 56cb4373..b754e9e8 100644 --- a/tests/Unit/Api/IssueRelation/RemoveTest.php +++ b/tests/Unit/Api/IssueRelation/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueRelation/ShowTest.php b/tests/Unit/Api/IssueRelation/ShowTest.php index 57065530..adf974e1 100644 --- a/tests/Unit/Api/IssueRelation/ShowTest.php +++ b/tests/Unit/Api/IssueRelation/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index 885f4fa1..79639c9d 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -18,7 +18,7 @@ class IssueRelationTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new IssueRelation(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $parameters = ['not-used']; diff --git a/tests/Unit/Api/IssueStatus/ListNamesTest.php b/tests/Unit/Api/IssueStatus/ListNamesTest.php index 231e4fc5..b0e8f4a6 100644 --- a/tests/Unit/Api/IssueStatus/ListNamesTest.php +++ b/tests/Unit/Api/IssueStatus/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueStatus/ListTest.php b/tests/Unit/Api/IssueStatus/ListTest.php index 9e4e573c..03b1d75e 100644 --- a/tests/Unit/Api/IssueStatus/ListTest.php +++ b/tests/Unit/Api/IssueStatus/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(IssueStatus::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueStatusTest.php b/tests/Unit/Api/IssueStatusTest.php index 8ef04106..93c42aa0 100644 --- a/tests/Unit/Api/IssueStatusTest.php +++ b/tests/Unit/Api/IssueStatusTest.php @@ -18,7 +18,7 @@ class IssueStatusTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new IssueStatus(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $parameters = ['not-used']; @@ -114,7 +114,7 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"issue_statuses":[{"id":1,"name":"IssueStatus 1"},{"id":5,"name":"IssueStatus 5"}]}'; @@ -148,7 +148,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"issue_statuses":[{"id":1,"name":"IssueStatus 1"},{"id":5,"name":"IssueStatus 5"}]}'; @@ -183,7 +183,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"issue_statuses":[{"id":1,"name":"IssueStatus 1"},{"id":5,"name":"IssueStatus 5"}]}'; @@ -218,7 +218,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -250,7 +250,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"issue_statuses":[{"id":5,"name":"IssueStatus 5"}]}'; @@ -278,7 +278,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName('IssueStatus 5')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/IssueTest.php b/tests/Unit/Api/IssueTest.php index b00d8c21..fd9b4660 100644 --- a/tests/Unit/Api/IssueTest.php +++ b/tests/Unit/Api/IssueTest.php @@ -40,7 +40,7 @@ public static function getPriorityConstantsData(): array * @dataProvider getPriorityConstantsData */ #[DataProvider('getPriorityConstantsData')] - public function testPriorityConstants($expected, $value) + public function testPriorityConstants($expected, $value): void { $this->assertSame($expected, $value); } @@ -48,7 +48,7 @@ public function testPriorityConstants($expected, $value) /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Issue(MockClient::create()); @@ -75,7 +75,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -109,7 +109,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; @@ -144,7 +144,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test cleanParams() with Client for BC */ - public function testCreateWithClientCleansParameters() + public function testCreateWithClientCleansParameters(): void { // Test values $response = ''; diff --git a/tests/Unit/Api/Membership/CreateTest.php b/tests/Unit/Api/Membership/CreateTest.php index c2f83bda..9a5813cf 100644 --- a/tests/Unit/Api/Membership/CreateTest.php +++ b/tests/Unit/Api/Membership/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -65,7 +65,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -89,7 +89,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -108,7 +108,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Membership/ListByProjectTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php index c877e0b0..b1bac7be 100644 --- a/tests/Unit/Api/Membership/ListByProjectTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -15,7 +15,7 @@ #[CoversClass(Membership::class)] class ListByProjectTest extends TestCase { - public function testListByProjectWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -41,7 +41,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByProject(5)); } - public function testListByProjectWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -72,7 +72,7 @@ public function testListByProjectWithParametersReturnsResponse() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new Membership(MockClient::create()); @@ -82,7 +82,7 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj $api->listByProject($projectIdentifier); } - public function testListByProjectThrowsException() + public function testListByProjectThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Membership/RemoveMemberTest.php b/tests/Unit/Api/Membership/RemoveMemberTest.php index 569ef5e5..584c928b 100644 --- a/tests/Unit/Api/Membership/RemoveMemberTest.php +++ b/tests/Unit/Api/Membership/RemoveMemberTest.php @@ -15,7 +15,7 @@ class RemoveMemberTest extends TestCase * @dataProvider getRemoveMemberData */ #[DataProvider('getRemoveMemberData')] - public function testRemoveMemberReturnsCorrectResponse($projectIdentifier, $userId, array $params, $expectedPath, $responseCode, $response) + public function testRemoveMemberReturnsCorrectResponse($projectIdentifier, $userId, array $params, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -68,7 +68,7 @@ public static function getRemoveMemberData(): array ]; } - public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() + public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject(): void { $client = AssertingHttpClient::create( $this, @@ -90,7 +90,7 @@ public function testRemoveMemberReturnsFalseIfUserIsNotMemberOfProject() $this->assertFalse($api->removeMember(1, 2)); } - public function testRemoveMemberReturnsFalseIfMemberlistIsMissing() + public function testRemoveMemberReturnsFalseIfMemberlistIsMissing(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Membership/RemoveTest.php b/tests/Unit/Api/Membership/RemoveTest.php index eff7384c..57bf7338 100644 --- a/tests/Unit/Api/Membership/RemoveTest.php +++ b/tests/Unit/Api/Membership/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Membership/UpdateTest.php b/tests/Unit/Api/Membership/UpdateTest.php index dd103cc2..e8e498b6 100644 --- a/tests/Unit/Api/Membership/UpdateTest.php +++ b/tests/Unit/Api/Membership/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -62,7 +62,7 @@ public static function getUpdateData(): array ]; } - public function testUpdateReturnsEmptyString() + public function testUpdateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -86,7 +86,7 @@ public function testUpdateReturnsEmptyString() $this->assertSame('', $return); } - public function testUpdateThrowsExceptionWithEmptyParameters() + public function testUpdateThrowsExceptionWithEmptyParameters(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -105,7 +105,7 @@ public function testUpdateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteUpdateParameterProvider */ #[DataProvider('incompleteUpdateParameterProvider')] - public function testUpdateThrowsExceptionIfMandatoyParametersAreMissing($parameters) + public function testUpdateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index bab9076e..28b1e463 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -18,7 +18,7 @@ class MembershipTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Membership(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $parameters = ['not-used']; diff --git a/tests/Unit/Api/News/ListByProjectTest.php b/tests/Unit/Api/News/ListByProjectTest.php index 61009a6e..4a234d4c 100644 --- a/tests/Unit/Api/News/ListByProjectTest.php +++ b/tests/Unit/Api/News/ListByProjectTest.php @@ -15,7 +15,7 @@ #[CoversClass(News::class)] class ListByProjectTest extends TestCase { - public function testListByProjectWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse(): void { // Test values $projectId = 5; @@ -42,7 +42,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByProject($projectId)); } - public function testListByProjectWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse(): void { // Test values $projectId = 5; @@ -74,7 +74,7 @@ public function testListByProjectWithParametersReturnsResponse() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new News(MockClient::create()); @@ -84,7 +84,7 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj $api->listByProject($projectIdentifier); } - public function testListByProjectThrowsException() + public function testListByProjectThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/News/ListTest.php b/tests/Unit/Api/News/ListTest.php index ae6eee9d..d8116065 100644 --- a/tests/Unit/Api/News/ListTest.php +++ b/tests/Unit/Api/News/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(News::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/NewsTest.php b/tests/Unit/Api/NewsTest.php index 126c983e..1d26f327 100644 --- a/tests/Unit/Api/NewsTest.php +++ b/tests/Unit/Api/NewsTest.php @@ -18,7 +18,7 @@ class NewsTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new News(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithProject() + public function testAllReturnsClientGetResponseWithProject(): void { // Test values $projectId = 5; @@ -111,7 +111,7 @@ public function testAllReturnsClientGetResponseWithProject() /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $projectId = 5; diff --git a/tests/Unit/Api/Project/ArchiveTest.php b/tests/Unit/Api/Project/ArchiveTest.php index 9d43a358..600a635b 100644 --- a/tests/Unit/Api/Project/ArchiveTest.php +++ b/tests/Unit/Api/Project/ArchiveTest.php @@ -15,7 +15,7 @@ #[CoversClass(Project::class)] class ArchiveTest extends TestCase { - public function testArchiveReturnsTrue() + public function testArchiveReturnsTrue(): void { $client = AssertingHttpClient::create( $this, @@ -33,7 +33,7 @@ public function testArchiveReturnsTrue() $this->assertTrue($api->archive(5)); } - public function testArchiveThrowsUnexpectedResponseException() + public function testArchiveThrowsUnexpectedResponseException(): void { $client = AssertingHttpClient::create( $this, @@ -54,7 +54,7 @@ public function testArchiveThrowsUnexpectedResponseException() $api->archive(5); } - public function testArchiveWithoutIntOrStringThrowsInvalidArgumentException() + public function testArchiveWithoutIntOrStringThrowsInvalidArgumentException(): void { $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/CloseTest.php b/tests/Unit/Api/Project/CloseTest.php index 778bb0fa..c48c54e8 100644 --- a/tests/Unit/Api/Project/CloseTest.php +++ b/tests/Unit/Api/Project/CloseTest.php @@ -13,7 +13,7 @@ #[CoversClass(Project::class)] class CloseTest extends TestCase { - public function testCloseReturnsTrue() + public function testCloseReturnsTrue(): void { $client = AssertingHttpClient::create( $this, @@ -31,7 +31,7 @@ public function testCloseReturnsTrue() $this->assertTrue($api->close(5)); } - public function testCloseThrowsUnexpectedResponseException() + public function testCloseThrowsUnexpectedResponseException(): void { $client = AssertingHttpClient::create( $this, @@ -52,7 +52,7 @@ public function testCloseThrowsUnexpectedResponseException() $api->close(5); } - public function testCloseWithoutIntOrStringThrowsInvalidArgumentException() + public function testCloseWithoutIntOrStringThrowsInvalidArgumentException(): void { $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/CreateTest.php b/tests/Unit/Api/Project/CreateTest.php index 751fec50..bb7b2ab8 100644 --- a/tests/Unit/Api/Project/CreateTest.php +++ b/tests/Unit/Api/Project/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -131,7 +131,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -155,7 +155,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -174,7 +174,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters) + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/ListNamesTest.php b/tests/Unit/Api/Project/ListNamesTest.php index 4024a96b..57e7dc99 100644 --- a/tests/Unit/Api/Project/ListNamesTest.php +++ b/tests/Unit/Api/Project/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesWithALotOfProjectsHandlesPagination() + public function testListNamesWithALotOfProjectsHandlesPagination(): void { $assertData = []; $projectsRequest1 = []; @@ -132,7 +132,7 @@ public function testListNamesWithALotOfProjectsHandlesPagination() $this->assertSame($assertData, $api->listNames()); } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/ListTest.php b/tests/Unit/Api/Project/ListTest.php index efe1fee6..ff6c7b52 100644 --- a/tests/Unit/Api/Project/ListTest.php +++ b/tests/Unit/Api/Project/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Project::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Project/RemoveTest.php b/tests/Unit/Api/Project/RemoveTest.php index 0a4300e6..048a857d 100644 --- a/tests/Unit/Api/Project/RemoveTest.php +++ b/tests/Unit/Api/Project/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/ReopenTest.php b/tests/Unit/Api/Project/ReopenTest.php index 26a83e80..b82e2153 100644 --- a/tests/Unit/Api/Project/ReopenTest.php +++ b/tests/Unit/Api/Project/ReopenTest.php @@ -13,7 +13,7 @@ #[CoversClass(Project::class)] class ReopenTest extends TestCase { - public function testReopenReturnsTrue() + public function testReopenReturnsTrue(): void { $client = AssertingHttpClient::create( $this, @@ -31,7 +31,7 @@ public function testReopenReturnsTrue() $this->assertTrue($api->reopen(5)); } - public function testReopenThrowsUnexpectedResponseException() + public function testReopenThrowsUnexpectedResponseException(): void { $client = AssertingHttpClient::create( $this, @@ -52,7 +52,7 @@ public function testReopenThrowsUnexpectedResponseException() $api->reopen(5); } - public function testReopenWithoutIntOrStringThrowsInvalidArgumentException() + public function testReopenWithoutIntOrStringThrowsInvalidArgumentException(): void { $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/ShowTest.php b/tests/Unit/Api/Project/ShowTest.php index fc646992..a1685e65 100644 --- a/tests/Unit/Api/Project/ShowTest.php +++ b/tests/Unit/Api/Project/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($identifier, array $params, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($identifier, array $params, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/UnarchiveTest.php b/tests/Unit/Api/Project/UnarchiveTest.php index 182b0eb8..9b2b6840 100644 --- a/tests/Unit/Api/Project/UnarchiveTest.php +++ b/tests/Unit/Api/Project/UnarchiveTest.php @@ -13,7 +13,7 @@ #[CoversClass(Project::class)] class UnarchiveTest extends TestCase { - public function testUnarchiveReturnsTrue() + public function testUnarchiveReturnsTrue(): void { $client = AssertingHttpClient::create( $this, @@ -31,7 +31,7 @@ public function testUnarchiveReturnsTrue() $this->assertTrue($api->unarchive(5)); } - public function testUnarchiveThrowsUnexpectedResponseException() + public function testUnarchiveThrowsUnexpectedResponseException(): void { $client = AssertingHttpClient::create( $this, @@ -52,7 +52,7 @@ public function testUnarchiveThrowsUnexpectedResponseException() $api->unarchive(5); } - public function testUnarchiveWithoutIntOrStringThrowsInvalidArgumentException() + public function testUnarchiveWithoutIntOrStringThrowsInvalidArgumentException(): void { $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/UpdateTest.php b/tests/Unit/Api/Project/UpdateTest.php index 7abd087c..2328d467 100644 --- a/tests/Unit/Api/Project/UpdateTest.php +++ b/tests/Unit/Api/Project/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/ProjectTest.php b/tests/Unit/Api/ProjectTest.php index 1c05a772..468b05d1 100644 --- a/tests/Unit/Api/ProjectTest.php +++ b/tests/Unit/Api/ProjectTest.php @@ -20,7 +20,7 @@ class ProjectTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Project(MockClient::create()); @@ -47,7 +47,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -81,7 +81,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; @@ -116,7 +116,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"projects":[{"id":1,"name":"Project 1"},{"id":5,"name":"Project 5"}]}'; @@ -150,7 +150,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"projects":[{"id":1,"name":"Project 1"},{"id":5,"name":"Project 5"}]}'; @@ -185,7 +185,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"projects":[{"id":1,"name":"Project 1"},{"id":5,"name":"Project 5"}]}'; @@ -220,7 +220,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -252,7 +252,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"projects":[{"id":5,"name":"Project 5"}]}'; @@ -280,7 +280,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName('Project 5')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -309,7 +309,7 @@ function ($errno, $errstr): bool { $api->getIdByName('Project 1'); } - public function testDeprecatedPrepareParamsXml() + public function testDeprecatedPrepareParamsXml(): void { $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Query/ListTest.php b/tests/Unit/Api/Query/ListTest.php index e000b977..4062c04e 100644 --- a/tests/Unit/Api/Query/ListTest.php +++ b/tests/Unit/Api/Query/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Query::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/QueryTest.php b/tests/Unit/Api/QueryTest.php index d2dc0e5a..22c8a158 100644 --- a/tests/Unit/Api/QueryTest.php +++ b/tests/Unit/Api/QueryTest.php @@ -18,7 +18,7 @@ class QueryTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Query(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; diff --git a/tests/Unit/Api/Role/ListNamesTest.php b/tests/Unit/Api/Role/ListNamesTest.php index 769671c3..c304cd97 100644 --- a/tests/Unit/Api/Role/ListNamesTest.php +++ b/tests/Unit/Api/Role/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Role/ListTest.php b/tests/Unit/Api/Role/ListTest.php index b0026edd..301e8054 100644 --- a/tests/Unit/Api/Role/ListTest.php +++ b/tests/Unit/Api/Role/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Role::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Role/ShowTest.php b/tests/Unit/Api/Role/ShowTest.php index 398085dd..10de7af7 100644 --- a/tests/Unit/Api/Role/ShowTest.php +++ b/tests/Unit/Api/Role/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/RoleTest.php b/tests/Unit/Api/RoleTest.php index 208b3c5d..f49f7d8c 100644 --- a/tests/Unit/Api/RoleTest.php +++ b/tests/Unit/Api/RoleTest.php @@ -18,7 +18,7 @@ class RoleTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Role(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $parameters = ['not-used']; @@ -114,7 +114,7 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"roles":[{"id":1,"name":"Role 1"},{"id":5,"name":"Role 5"}]}'; @@ -148,7 +148,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"roles":[{"id":1,"name":"Role 1"},{"id":5,"name":"Role 5"}]}'; @@ -183,7 +183,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"roles":[{"id":1,"name":"Role 1"},{"id":5,"name":"Role 5"}]}'; @@ -218,7 +218,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/Search/ListByQueryTest.php b/tests/Unit/Api/Search/ListByQueryTest.php index d80515c1..02848dcb 100644 --- a/tests/Unit/Api/Search/ListByQueryTest.php +++ b/tests/Unit/Api/Search/ListByQueryTest.php @@ -11,7 +11,7 @@ #[CoversClass(Search::class)] class ListByQueryTest extends TestCase { - public function testListByQueryWithoutParametersReturnsResponse() + public function testListByQueryWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListByQueryWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByQuery('query')); } - public function testListByQueryWithParametersReturnsResponse() + public function testListByQueryWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListByQueryWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByQuery('query', $parameters)); } - public function testListByQueryThrowsException() + public function testListByQueryThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Search/SearchTest.php b/tests/Unit/Api/Search/SearchTest.php index 524e3445..22b953d3 100644 --- a/tests/Unit/Api/Search/SearchTest.php +++ b/tests/Unit/Api/Search/SearchTest.php @@ -12,7 +12,7 @@ #[CoversClass(Search::class)] class SearchTest extends TestCase { - public function testSearchTriggersDeprecationWarning() + public function testSearchTriggersDeprecationWarning(): void { $api = new Search(MockClient::create()); @@ -37,7 +37,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testSearchReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testSearchReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -68,7 +68,7 @@ public static function getAllData(): array ]; } - public function testSearchReturnsClientGetResponseWithParameters() + public function testSearchReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; diff --git a/tests/Unit/Api/TimeEntry/CreateTest.php b/tests/Unit/Api/TimeEntry/CreateTest.php index 0741de79..79225dc7 100644 --- a/tests/Unit/Api/TimeEntry/CreateTest.php +++ b/tests/Unit/Api/TimeEntry/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -103,7 +103,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -127,7 +127,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Test values $response = 'API Response'; @@ -149,7 +149,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters) + public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/TimeEntry/ListTest.php b/tests/Unit/Api/TimeEntry/ListTest.php index 0524d9da..27c0fb89 100644 --- a/tests/Unit/Api/TimeEntry/ListTest.php +++ b/tests/Unit/Api/TimeEntry/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(TimeEntry::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = [ @@ -68,7 +68,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/TimeEntry/RemoveTest.php b/tests/Unit/Api/TimeEntry/RemoveTest.php index 498ae5a9..fedc10f0 100644 --- a/tests/Unit/Api/TimeEntry/RemoveTest.php +++ b/tests/Unit/Api/TimeEntry/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntry/ShowTest.php b/tests/Unit/Api/TimeEntry/ShowTest.php index a255fb99..3dd3d737 100644 --- a/tests/Unit/Api/TimeEntry/ShowTest.php +++ b/tests/Unit/Api/TimeEntry/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntry/UpdateTest.php b/tests/Unit/Api/TimeEntry/UpdateTest.php index 7d0516f8..aebccee8 100644 --- a/tests/Unit/Api/TimeEntry/UpdateTest.php +++ b/tests/Unit/Api/TimeEntry/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php b/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php index 9fbc5600..9f60c1bb 100644 --- a/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php +++ b/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntryActivity/ListTest.php b/tests/Unit/Api/TimeEntryActivity/ListTest.php index 38127a3d..c7dd27c0 100644 --- a/tests/Unit/Api/TimeEntryActivity/ListTest.php +++ b/tests/Unit/Api/TimeEntryActivity/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(TimeEntryActivity::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/TimeEntryActivityTest.php b/tests/Unit/Api/TimeEntryActivityTest.php index a300427c..cd687797 100644 --- a/tests/Unit/Api/TimeEntryActivityTest.php +++ b/tests/Unit/Api/TimeEntryActivityTest.php @@ -18,7 +18,7 @@ class TimeEntryActivityTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new TimeEntryActivity(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = ['not-used']; @@ -111,7 +111,7 @@ public function testAllReturnsClientGetResponseWithParameters() $this->assertSame($expectedReturn, $api->all($parameters)); } - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { $response = '{"time_entry_activities":[{"id":1,"name":"TimeEntryActivities 1"},{"id":2,"name":"TimeEntryActivities 2"}]}'; $expectedReturn = [ @@ -138,7 +138,7 @@ public function testListingReturnsNameIdArray() $this->assertSame($expectedReturn, $api->listing()); } - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { $response = '{"time_entry_activities":[{"id":1,"name":"TimeEntryActivities 1"},{"id":2,"name":"TimeEntryActivities 2"}]}'; $expectedReturn = [ @@ -169,7 +169,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -198,7 +198,7 @@ function ($errno, $errstr): bool { $api->listing(); } - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { $response = '{"time_entry_activities":[{"id":2,"name":"TimeEntryActivities 2"}]}'; @@ -222,7 +222,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(2, $api->getIdByName('TimeEntryActivities 2')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php index 8e4eb71a..965ce4f7 100644 --- a/tests/Unit/Api/TimeEntryTest.php +++ b/tests/Unit/Api/TimeEntryTest.php @@ -18,7 +18,7 @@ class TimeEntryTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new TimeEntry(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = [ diff --git a/tests/Unit/Api/Tracker/ListNamesTest.php b/tests/Unit/Api/Tracker/ListNamesTest.php index 6b3db066..cbd4cdb4 100644 --- a/tests/Unit/Api/Tracker/ListNamesTest.php +++ b/tests/Unit/Api/Tracker/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListNamesData(): array ]; } - public function testListNamesCallsHttpClientOnlyOnce() + public function testListNamesCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Tracker/ListTest.php b/tests/Unit/Api/Tracker/ListTest.php index 5e9ac948..8db664b3 100644 --- a/tests/Unit/Api/Tracker/ListTest.php +++ b/tests/Unit/Api/Tracker/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(Tracker::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = ['not-used']; @@ -64,7 +64,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/TrackerTest.php b/tests/Unit/Api/TrackerTest.php index 5ba445b2..72a8c7e7 100644 --- a/tests/Unit/Api/TrackerTest.php +++ b/tests/Unit/Api/TrackerTest.php @@ -18,7 +18,7 @@ class TrackerTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Tracker(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParametersAndProject() + public function testAllReturnsClientGetResponseWithParametersAndProject(): void { // Test values $parameters = ['not-used']; @@ -114,7 +114,7 @@ public function testAllReturnsClientGetResponseWithParametersAndProject() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"trackers":[{"id":1,"name":"Tracker 1"},{"id":5,"name":"Tracker 5"}]}'; @@ -148,7 +148,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"trackers":[{"id":1,"name":"Tracker 1"},{"id":5,"name":"Tracker 5"}]}'; @@ -183,7 +183,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"trackers":[{"id":1,"name":"Tracker 1"},{"id":5,"name":"Tracker 5"}]}'; @@ -218,7 +218,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -250,7 +250,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"trackers":[{"id":5,"name":"Tracker 5"}]}'; @@ -278,7 +278,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName('Tracker 5')); } - public function testGgetIdByNameTriggersDeprecationWarning() + public function testGgetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/User/CreateTest.php b/tests/Unit/Api/User/CreateTest.php index 72fe0a0c..c1abfbf5 100644 --- a/tests/Unit/Api/User/CreateTest.php +++ b/tests/Unit/Api/User/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -90,7 +90,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -114,7 +114,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateThrowsExceptionWithEmptyParameters() + public function testCreateThrowsExceptionWithEmptyParameters(): void { // Test values $response = 'API Response'; @@ -136,7 +136,7 @@ public function testCreateThrowsExceptionWithEmptyParameters() * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters) + public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/User/ListLoginsTest.php b/tests/Unit/Api/User/ListLoginsTest.php index 23e0643e..c9a530f0 100644 --- a/tests/Unit/Api/User/ListLoginsTest.php +++ b/tests/Unit/Api/User/ListLoginsTest.php @@ -17,7 +17,7 @@ class ListLoginsTest extends TestCase * @dataProvider getListLoginsData */ #[DataProvider('getListLoginsData')] - public function testListLoginsReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse) + public function testListLoginsReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -73,7 +73,7 @@ public static function getListLoginsData(): array ]; } - public function testListLoginsWithALotOfUsersHandlesPagination() + public function testListLoginsWithALotOfUsersHandlesPagination(): void { $assertData = []; $usersRequest1 = []; @@ -132,7 +132,7 @@ public function testListLoginsWithALotOfUsersHandlesPagination() $this->assertSame($assertData, $api->listLogins()); } - public function testListLoginsCallsHttpClientOnlyOnce() + public function testListLoginsCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/ListTest.php b/tests/Unit/Api/User/ListTest.php index ab12faf7..c2b45252 100644 --- a/tests/Unit/Api/User/ListTest.php +++ b/tests/Unit/Api/User/ListTest.php @@ -11,7 +11,7 @@ #[CoversClass(User::class)] class ListTest extends TestCase { - public function testListWithoutParametersReturnsResponse() + public function testListWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -37,7 +37,7 @@ public function testListWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list()); } - public function testListWithParametersReturnsResponse() + public function testListWithParametersReturnsResponse(): void { // Test values $parameters = [ @@ -67,7 +67,7 @@ public function testListWithParametersReturnsResponse() $this->assertSame($expectedReturn, $api->list($parameters)); } - public function testListThrowsException() + public function testListThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/User/RemoveTest.php b/tests/Unit/Api/User/RemoveTest.php index 158635b0..84ae9967 100644 --- a/tests/Unit/Api/User/RemoveTest.php +++ b/tests/Unit/Api/User/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/ShowTest.php b/tests/Unit/Api/User/ShowTest.php index e6e15c9d..e872c025 100644 --- a/tests/Unit/Api/User/ShowTest.php +++ b/tests/Unit/Api/User/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($userId, array $params, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($userId, array $params, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/UpdateTest.php b/tests/Unit/Api/User/UpdateTest.php index 6cb42e0f..32d0a66a 100644 --- a/tests/Unit/Api/User/UpdateTest.php +++ b/tests/Unit/Api/User/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/UserTest.php b/tests/Unit/Api/UserTest.php index 5a327ae0..5eec179c 100644 --- a/tests/Unit/Api/UserTest.php +++ b/tests/Unit/Api/UserTest.php @@ -18,7 +18,7 @@ class UserTest extends TestCase /** * Test getCurrentUser(). */ - public function testGetCurrentUserReturnsClientGetResponse() + public function testGetCurrentUserReturnsClientGetResponse(): void { // Test values $response = '["API Response"]'; @@ -52,7 +52,7 @@ public function testGetCurrentUserReturnsClientGetResponse() /** * Test getIdByUsername(). */ - public function testGetIdByUsernameMakesGetRequest() + public function testGetIdByUsernameMakesGetRequest(): void { // Test values $response = '{"users":[{"id":5,"login":"user_5"}]}'; @@ -83,7 +83,7 @@ public function testGetIdByUsernameMakesGetRequest() $this->assertSame(5, $api->getIdByUsername('user_5')); } - public function testGetIdByUsernameTriggersDeprecationWarning() + public function testGetIdByUsernameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -115,7 +115,7 @@ function ($errno, $errstr): bool { /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new User(MockClient::create()); @@ -142,7 +142,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -176,7 +176,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = [ @@ -215,7 +215,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"users":[{"id":1,"login":"user_1"},{"id":5,"login":"user_5"}]}'; @@ -249,7 +249,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"users":[{"id":1,"login":"user_1"},{"id":5,"login":"user_5"}]}'; @@ -284,7 +284,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"users":[{"id":1,"login":"user_1"},{"id":5,"login":"user_5"}]}'; @@ -319,7 +319,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') diff --git a/tests/Unit/Api/Version/CreateTest.php b/tests/Unit/Api/Version/CreateTest.php index 4a2fbaf3..9c8428b3 100644 --- a/tests/Unit/Api/Version/CreateTest.php +++ b/tests/Unit/Api/Version/CreateTest.php @@ -19,7 +19,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -130,7 +130,7 @@ public static function getCreateData(): array ]; } - public function testCreateReturnsEmptyString() + public function testCreateReturnsEmptyString(): void { $client = AssertingHttpClient::create( $this, @@ -154,7 +154,7 @@ public function testCreateReturnsEmptyString() $this->assertSame('', $return); } - public function testCreateWithEmptyParametersThrowsMissingParameterException() + public function testCreateWithEmptyParametersThrowsMissingParameterException(): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); @@ -169,7 +169,7 @@ public function testCreateWithEmptyParametersThrowsMissingParameterException() $api->create(5); } - public function testCreateWithMissingNameInParametersThrowsMissingParameterException() + public function testCreateWithMissingNameInParametersThrowsMissingParameterException(): void { // Test values $parameters = [ @@ -189,7 +189,7 @@ public function testCreateWithMissingNameInParametersThrowsMissingParameterExcep $api->create(5, $parameters); } - public function testCreateWithInvalidStatusThrowsInvalidParameterException() + public function testCreateWithInvalidStatusThrowsInvalidParameterException(): void { // Test values $parameters = [ diff --git a/tests/Unit/Api/Version/ListByProjectTest.php b/tests/Unit/Api/Version/ListByProjectTest.php index 7d6e3171..8cb2dbae 100644 --- a/tests/Unit/Api/Version/ListByProjectTest.php +++ b/tests/Unit/Api/Version/ListByProjectTest.php @@ -15,7 +15,7 @@ #[CoversClass(Version::class)] class ListByProjectTest extends TestCase { - public function testListByProjectWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -41,7 +41,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByProject(5)); } - public function testListByProjectWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse(): void { // Test values $parameters = [ @@ -75,7 +75,7 @@ public function testListByProjectWithParametersReturnsResponse() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new Version(MockClient::create()); @@ -85,7 +85,7 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj $api->listByProject($projectIdentifier); } - public function testListByProjectThrowsException() + public function testListByProjectThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Version/ListNamesByProjectTest.php b/tests/Unit/Api/Version/ListNamesByProjectTest.php index 65c3b8a0..ea343ef1 100644 --- a/tests/Unit/Api/Version/ListNamesByProjectTest.php +++ b/tests/Unit/Api/Version/ListNamesByProjectTest.php @@ -21,7 +21,7 @@ class ListNamesByProjectTest extends TestCase * @dataProvider getListNamesByProjectData */ #[DataProvider('getListNamesByProjectData')] - public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse) + public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse): void { $client = AssertingHttpClient::create( $this, @@ -79,7 +79,7 @@ public static function getListNamesByProjectData(): array ]; } - public function testListNamesByProjectCallsHttpClientOnlyOnce() + public function testListNamesByProjectCallsHttpClientOnlyOnce(): void { $client = AssertingHttpClient::create( $this, @@ -116,7 +116,7 @@ public function testListNamesByProjectCallsHttpClientOnlyOnce() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListNamesByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListNamesByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new Version($this->createMock(HttpClient::class)); diff --git a/tests/Unit/Api/Version/RemoveTest.php b/tests/Unit/Api/Version/RemoveTest.php index 16b98c8e..2fe1c212 100644 --- a/tests/Unit/Api/Version/RemoveTest.php +++ b/tests/Unit/Api/Version/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/ShowTest.php b/tests/Unit/Api/Version/ShowTest.php index 0c3f6fc9..73da9055 100644 --- a/tests/Unit/Api/Version/ShowTest.php +++ b/tests/Unit/Api/Version/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($version, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($version, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/UpdateTest.php b/tests/Unit/Api/Version/UpdateTest.php index e51cc786..5b55302e 100644 --- a/tests/Unit/Api/Version/UpdateTest.php +++ b/tests/Unit/Api/Version/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, @@ -173,7 +173,7 @@ public static function getUpdateData(): array ]; } - public function testUpdateWithInvalidStatusThrowsInvalidParameterException() + public function testUpdateWithInvalidStatusThrowsInvalidParameterException(): void { // Test values $parameters = [ @@ -195,7 +195,7 @@ public function testUpdateWithInvalidStatusThrowsInvalidParameterException() $api->update(5, $parameters); } - public function testUpdateWithInvalidSharingThrowsInvalidParameterException() + public function testUpdateWithInvalidSharingThrowsInvalidParameterException(): void { // Test values $parameters = [ diff --git a/tests/Unit/Api/VersionTest.php b/tests/Unit/Api/VersionTest.php index 7666934e..48033fab 100644 --- a/tests/Unit/Api/VersionTest.php +++ b/tests/Unit/Api/VersionTest.php @@ -19,7 +19,7 @@ class VersionTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Version(MockClient::create()); @@ -46,7 +46,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -80,7 +80,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = [ @@ -119,7 +119,7 @@ public function testAllReturnsClientGetResponseWithParameters() /** * Test listing(). */ - public function testListingReturnsNameIdArray() + public function testListingReturnsNameIdArray(): void { // Test values $response = '{"versions":[{"id":1,"name":"Version 1"},{"id":5,"name":"Version 5"}]}'; @@ -151,7 +151,7 @@ public function testListingReturnsNameIdArray() /** * Test listing(). */ - public function testListingReturnsIdNameIfReverseIsFalseArray() + public function testListingReturnsIdNameIfReverseIsFalseArray(): void { // Test values $response = '{"versions":[{"id":1,"name":"Version 1"},{"id":5,"name":"Version 5"}]}'; @@ -183,7 +183,7 @@ public function testListingReturnsIdNameIfReverseIsFalseArray() /** * Test listing(). */ - public function testListingCallsGetOnlyTheFirstTime() + public function testListingCallsGetOnlyTheFirstTime(): void { // Test values $response = '{"versions":[{"id":1,"name":"Version 1"},{"id":5,"name":"Version 5"}]}'; @@ -216,7 +216,7 @@ public function testListingCallsGetOnlyTheFirstTime() /** * Test listing(). */ - public function testListingCallsGetEveryTimeWithForceUpdate() + public function testListingCallsGetEveryTimeWithForceUpdate(): void { // Test values $response = '{"versions":[{"id":1,"name":"Version 1"},{"id":5,"name":"Version 5"}]}'; @@ -249,7 +249,7 @@ public function testListingCallsGetEveryTimeWithForceUpdate() /** * Test listing(). */ - public function testListingTriggersDeprecationWarning() + public function testListingTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -281,7 +281,7 @@ function ($errno, $errstr): bool { /** * Test getIdByName(). */ - public function testGetIdByNameMakesGetRequest() + public function testGetIdByNameMakesGetRequest(): void { // Test values $response = '{"versions":[{"id":5,"name":"Version 5"}]}'; @@ -309,7 +309,7 @@ public function testGetIdByNameMakesGetRequest() $this->assertSame(5, $api->getIdByName(5, 'Version 5')); } - public function testGetIdByNameTriggersDeprecationWarning() + public function testGetIdByNameTriggersDeprecationWarning(): void { $client = $this->createMock(Client::class); $client->method('requestGet') @@ -346,7 +346,7 @@ function ($errno, $errstr): bool { * @param string $sharingValue */ #[DataProvider('invalidSharingProvider')] - public function testCreateThrowsExceptionWithInvalidSharing($sharingValue) + public function testCreateThrowsExceptionWithInvalidSharing($sharingValue): void { // Test values $parameters = [ diff --git a/tests/Unit/Api/Wiki/CreateTest.php b/tests/Unit/Api/Wiki/CreateTest.php index f1e46d1e..ebf9eda3 100644 --- a/tests/Unit/Api/Wiki/CreateTest.php +++ b/tests/Unit/Api/Wiki/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testCreateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/ListByProjectTest.php b/tests/Unit/Api/Wiki/ListByProjectTest.php index 43bd53eb..c0b21d60 100644 --- a/tests/Unit/Api/Wiki/ListByProjectTest.php +++ b/tests/Unit/Api/Wiki/ListByProjectTest.php @@ -15,7 +15,7 @@ #[CoversClass(Wiki::class)] class ListByProjectTest extends TestCase { - public function testListByProjectWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse(): void { // Test values $response = '["API Response"]'; @@ -41,7 +41,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $this->assertSame($expectedReturn, $api->listByProject(5)); } - public function testListByProjectWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse(): void { // Test values $parameters = [ @@ -75,7 +75,7 @@ public function testListByProjectWithParametersReturnsResponse() * @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers */ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')] - public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier): void { $api = new Wiki(MockClient::create()); @@ -85,7 +85,7 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj $api->listByProject($projectIdentifier); } - public function testListByProjectThrowsException() + public function testListByProjectThrowsException(): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Wiki/RemoveTest.php b/tests/Unit/Api/Wiki/RemoveTest.php index 6dfb9eff..51bb3019 100644 --- a/tests/Unit/Api/Wiki/RemoveTest.php +++ b/tests/Unit/Api/Wiki/RemoveTest.php @@ -17,7 +17,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $page, $expectedPath, $responseCode, $response) + public function testRemoveReturnsCorrectResponse($id, $page, $expectedPath, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/ShowTest.php b/tests/Unit/Api/Wiki/ShowTest.php index 00d23c41..75ef788e 100644 --- a/tests/Unit/Api/Wiki/ShowTest.php +++ b/tests/Unit/Api/Wiki/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($identifier, $page, $version, $expectedPath, $response, $expectedReturn) + public function testShowReturnsCorrectResponse($identifier, $page, $version, $expectedPath, $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/UpdateTest.php b/tests/Unit/Api/Wiki/UpdateTest.php index 3ed667ff..923012d2 100644 --- a/tests/Unit/Api/Wiki/UpdateTest.php +++ b/tests/Unit/Api/Wiki/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response) + public function testUpdateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/WikiTest.php b/tests/Unit/Api/WikiTest.php index 3fe1f2a7..9c487efa 100644 --- a/tests/Unit/Api/WikiTest.php +++ b/tests/Unit/Api/WikiTest.php @@ -18,7 +18,7 @@ class WikiTest extends TestCase /** * Test all(). */ - public function testAllTriggersDeprecationWarning() + public function testAllTriggersDeprecationWarning(): void { $api = new Wiki(MockClient::create()); @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse) + public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -79,7 +79,7 @@ public static function getAllData(): array /** * Test all(). */ - public function testAllReturnsClientGetResponseWithParameters() + public function testAllReturnsClientGetResponseWithParameters(): void { // Test values $parameters = [ diff --git a/tests/Unit/Client/NativeCurlClient/RequestTest.php b/tests/Unit/Client/NativeCurlClient/RequestTest.php index 24d2cfff..001b4cdf 100644 --- a/tests/Unit/Client/NativeCurlClient/RequestTest.php +++ b/tests/Unit/Client/NativeCurlClient/RequestTest.php @@ -20,7 +20,7 @@ class RequestTest extends TestCase * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content) + public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content): void { $namespace = 'Redmine\Client'; @@ -93,7 +93,7 @@ public static function getRequestReponseData(): array ]; } - public function testRequestWithUploadAndFilepathReturnsCorrectResponse() + public function testRequestWithUploadAndFilepathReturnsCorrectResponse(): void { $namespace = 'Redmine\Client'; diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 610f4510..0cfd6c8b 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -35,7 +35,7 @@ class NativeCurlClientTest extends TestCase CURLOPT_RETURNTRANSFER => 1, ]; - public function testApiKeyShouldBePassToConstructor() + public function testApiKeyShouldBePassToConstructor(): void { $client = new NativeCurlClient( 'http://test.local', @@ -47,7 +47,7 @@ public function testApiKeyShouldBePassToConstructor() $this->assertInstanceOf(HttpClient::class, $client); } - public function testShouldPassUsernameAndPasswordToConstructor() + public function testShouldPassUsernameAndPasswordToConstructor(): void { $client = new NativeCurlClient( 'http://test.local', @@ -59,7 +59,7 @@ public function testShouldPassUsernameAndPasswordToConstructor() $this->assertInstanceOf(Client::class, $client); } - public function testGetLastResponseStatusCodeIsInitialNull() + public function testGetLastResponseStatusCodeIsInitialNull(): void { $client = new NativeCurlClient( 'http://test.local', @@ -69,7 +69,7 @@ public function testGetLastResponseStatusCodeIsInitialNull() $this->assertSame(0, $client->getLastResponseStatusCode()); } - public function testGetLastResponseContentTypeIsInitialEmpty() + public function testGetLastResponseContentTypeIsInitialEmpty(): void { $client = new NativeCurlClient( 'http://test.local', @@ -79,7 +79,7 @@ public function testGetLastResponseContentTypeIsInitialEmpty() $this->assertSame('', $client->getLastResponseContentType()); } - public function testGetLastResponseBodyIsInitialEmpty() + public function testGetLastResponseBodyIsInitialEmpty(): void { $client = new NativeCurlClient( 'http://test.local', @@ -89,7 +89,7 @@ public function testGetLastResponseBodyIsInitialEmpty() $this->assertSame('', $client->getLastResponseBody()); } - public function testStartAndStopImpersonateUser() + public function testStartAndStopImpersonateUser(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -145,7 +145,7 @@ public function testStartAndStopImpersonateUser() $client->requestGet('/path'); } - public function testSetSslVersion() + public function testSetSslVersion(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2_0, @@ -200,7 +200,7 @@ public function testSetSslVersion() $client->requestGet('/path'); } - public function testSetSslVerifypeer() + public function testSetSslVerifypeer(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -256,7 +256,7 @@ public function testSetSslVerifypeer() $client->requestGet('/path'); } - public function testSetSslVerifyhost() + public function testSetSslVerifyhost(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -312,7 +312,7 @@ public function testSetSslVerifyhost() $client->requestGet('/path'); } - public function testSetCustomHttpHeaders() + public function testSetCustomHttpHeaders(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -374,7 +374,7 @@ public function testSetCustomHttpHeaders() $client->requestGet('/path'); } - public function testSetCustomHost() + public function testSetCustomHost(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -432,7 +432,7 @@ public function testSetCustomHost() $client->requestGet('/path'); } - public function testSetPort() + public function testSetPort(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -487,7 +487,7 @@ public function testSetPort() $client->requestGet('/path'); } - public function testCustomPortWillSetFromSchema() + public function testCustomPortWillSetFromSchema(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -537,7 +537,7 @@ public function testCustomPortWillSetFromSchema() $client->requestGet('/path'); } - public function testCustomPortWillSetFromUrl() + public function testCustomPortWillSetFromUrl(): void { $expectedOptions = [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, @@ -591,7 +591,7 @@ public function testCustomPortWillSetFromUrl() * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content) + public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content): void { $curl = $this->createMock(stdClass::class); @@ -651,7 +651,7 @@ public static function getRequestReponseData(): array ]; } - public function testHandlingOfResponseWithoutContent() + public function testHandlingOfResponseWithoutContent(): void { $content = ''; $statusCode = 204; @@ -689,7 +689,7 @@ public function testHandlingOfResponseWithoutContent() $this->assertSame($content, $client->getLastResponseBody()); } - public function testCurlErrorThrowsException() + public function testCurlErrorThrowsException(): void { $curl = $this->createMock(stdClass::class); @@ -724,7 +724,7 @@ public function testCurlErrorThrowsException() * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function testGetApiShouldReturnApiInstance(string $apiName, string $class) + public function testGetApiShouldReturnApiInstance(string $apiName, string $class): void { $client = new NativeCurlClient( 'http://test.local', @@ -759,7 +759,7 @@ public static function getApiClassesProvider(): array ]; } - public function testGetApiShouldThrowException() + public function testGetApiShouldThrowException(): void { $client = new NativeCurlClient( 'http://test.local', diff --git a/tests/Unit/Client/Psr18Client/RequestTest.php b/tests/Unit/Client/Psr18Client/RequestTest.php index e766d6fa..af0ab4f0 100644 --- a/tests/Unit/Client/Psr18Client/RequestTest.php +++ b/tests/Unit/Client/Psr18Client/RequestTest.php @@ -25,7 +25,7 @@ class RequestTest extends TestCase * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content) + public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content): void { $httpClient = $this->createConfiguredMock(ClientInterface::class, [ 'sendRequest' => $this->createConfiguredMock(ResponseInterface::class, [ @@ -97,7 +97,7 @@ public static function getRequestReponseData(): array ]; } - public function testRequestThrowsClientException() + public function testRequestThrowsClientException(): void { $httpClient = $this->createMock(ClientInterface::class); $httpClient->expects($this->exactly(1))->method('sendRequest')->willThrowException( diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index b28bf85d..fd1f260c 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -23,7 +23,7 @@ #[CoversClass(Psr18Client::class)] class Psr18ClientTest extends TestCase { - public function testShouldPassApiKeyToConstructor() + public function testShouldPassApiKeyToConstructor(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -38,7 +38,7 @@ public function testShouldPassApiKeyToConstructor() $this->assertInstanceOf(HttpClient::class, $client); } - public function testServerRequestFactoryIsAcceptedInConstructorForBC() + public function testServerRequestFactoryIsAcceptedInConstructorForBC(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -62,7 +62,7 @@ public function testServerRequestFactoryIsAcceptedInConstructorForBC() $client->requestGet('/path.xml'); } - public function testShouldPassUsernameAndPasswordToConstructor() + public function testShouldPassUsernameAndPasswordToConstructor(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -77,7 +77,7 @@ public function testShouldPassUsernameAndPasswordToConstructor() $this->assertInstanceOf(Client::class, $client); } - public function testGetLastResponseStatusCodeIsInitialZero() + public function testGetLastResponseStatusCodeIsInitialZero(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -90,7 +90,7 @@ public function testGetLastResponseStatusCodeIsInitialZero() $this->assertSame(0, $client->getLastResponseStatusCode()); } - public function testGetLastResponseContentTypeIsInitialEmpty() + public function testGetLastResponseContentTypeIsInitialEmpty(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -103,7 +103,7 @@ public function testGetLastResponseContentTypeIsInitialEmpty() $this->assertSame('', $client->getLastResponseContentType()); } - public function testGetLastResponseBodyIsInitialEmpty() + public function testGetLastResponseBodyIsInitialEmpty(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -116,7 +116,7 @@ public function testGetLastResponseBodyIsInitialEmpty() $this->assertSame('', $client->getLastResponseBody()); } - public function testStartAndStopImpersonateUser() + public function testStartAndStopImpersonateUser(): void { $request = $this->createMock(RequestInterface::class); $request->expects($this->exactly(4)) @@ -146,7 +146,7 @@ public function testStartAndStopImpersonateUser() $client->requestGet('/path'); } - public function testRequestGetReturnsFalse() + public function testRequestGetReturnsFalse(): void { $response = $this->createMock(ResponseInterface::class); $response->method('getStatusCode')->willReturn(404); @@ -175,7 +175,7 @@ public function testRequestGetReturnsFalse() * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content) + public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content): void { $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($content); @@ -239,7 +239,7 @@ public static function getRequestReponseData(): array * @dataProvider getApiClassesProvider */ #[DataProvider('getApiClassesProvider')] - public function testGetApiShouldReturnApiInstance(string $apiName, string $class) + public function testGetApiShouldReturnApiInstance(string $apiName, string $class): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), @@ -277,7 +277,7 @@ public static function getApiClassesProvider(): array ]; } - public function testCreateWithoutFactoryThrowsException() + public function testCreateWithoutFactoryThrowsException(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('Redmine\Client\Psr18Client::__construct(): Argument #2 ($requestFactory) must be of type Psr\Http\Message\RequestFactoryInterface'); @@ -292,7 +292,7 @@ public function testCreateWithoutFactoryThrowsException() ); } - public function testGetApiShouldThrowException() + public function testGetApiShouldThrowException(): void { $client = new Psr18Client( $this->createMock(ClientInterface::class), diff --git a/tests/Unit/Exception/ClientExceptionTest.php b/tests/Unit/Exception/ClientExceptionTest.php index 6857a73d..3fbccedb 100644 --- a/tests/Unit/Exception/ClientExceptionTest.php +++ b/tests/Unit/Exception/ClientExceptionTest.php @@ -11,7 +11,7 @@ #[CoversClass(ClientException::class)] class ClientExceptionTest extends TestCase { - public function testClientException() + public function testClientException(): void { $exception = new ClientException(); diff --git a/tests/Unit/Exception/InvalidApiNameExceptionTest.php b/tests/Unit/Exception/InvalidApiNameExceptionTest.php index 4df5bba3..41a63e89 100644 --- a/tests/Unit/Exception/InvalidApiNameExceptionTest.php +++ b/tests/Unit/Exception/InvalidApiNameExceptionTest.php @@ -11,7 +11,7 @@ #[CoversClass(InvalidApiNameException::class)] class InvalidApiNameExceptionTest extends TestCase { - public function testInvalidApiNameException() + public function testInvalidApiNameException(): void { $exception = new InvalidApiNameException(); diff --git a/tests/Unit/Exception/InvalidParameterExceptionTest.php b/tests/Unit/Exception/InvalidParameterExceptionTest.php index f0b9eb6d..c96656bb 100644 --- a/tests/Unit/Exception/InvalidParameterExceptionTest.php +++ b/tests/Unit/Exception/InvalidParameterExceptionTest.php @@ -10,7 +10,7 @@ class InvalidParameterExceptionTest extends TestCase { - public function testInvalidParameterException() + public function testInvalidParameterException(): void { $exception = new InvalidParameterException(); diff --git a/tests/Unit/Exception/MissingParameterExceptionTest.php b/tests/Unit/Exception/MissingParameterExceptionTest.php index 7fdae1dd..792b1080 100644 --- a/tests/Unit/Exception/MissingParameterExceptionTest.php +++ b/tests/Unit/Exception/MissingParameterExceptionTest.php @@ -10,7 +10,7 @@ class MissingParameterExceptionTest extends TestCase { - public function testMissingParameterException() + public function testMissingParameterException(): void { $exception = new MissingParameterException(); diff --git a/tests/Unit/Exception/UnexpectedResponseExceptionTest.php b/tests/Unit/Exception/UnexpectedResponseExceptionTest.php index 58d0a606..2633526c 100644 --- a/tests/Unit/Exception/UnexpectedResponseExceptionTest.php +++ b/tests/Unit/Exception/UnexpectedResponseExceptionTest.php @@ -12,7 +12,7 @@ class UnexpectedResponseExceptionTest extends TestCase { - public function testCreateReturnsException() + public function testCreateReturnsException(): void { $response = $this->createMock(Response::class); @@ -22,7 +22,7 @@ public function testCreateReturnsException() $this->assertInstanceOf(RedmineException::class, $exception); } - public function testCreateWithThrowable() + public function testCreateWithThrowable(): void { $response = $this->createMock(Response::class); $throwable = new Exception('message', 5); @@ -33,7 +33,7 @@ public function testCreateWithThrowable() $this->assertSame($throwable, $exception->getPrevious()); } - public function testGetResponseReturnsResponse() + public function testGetResponseReturnsResponse(): void { $response = $this->createMock(Response::class); diff --git a/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php b/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php index 155866fc..96728d9d 100644 --- a/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeJsonRequestTest.php @@ -12,7 +12,7 @@ #[CoversClass(HttpFactory::class)] class MakeJsonRequestTest extends TestCase { - public function testMakeJsonRequest() + public function testMakeJsonRequest(): void { $response = HttpFactory::makeJsonRequest('GET', 'path.json', 'content'); diff --git a/tests/Unit/Http/HttpFactory/MakeRequestTest.php b/tests/Unit/Http/HttpFactory/MakeRequestTest.php index e3e9cdfd..aff333c5 100644 --- a/tests/Unit/Http/HttpFactory/MakeRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeRequestTest.php @@ -12,7 +12,7 @@ #[CoversClass(HttpFactory::class)] class MakeRequestTest extends TestCase { - public function testMakeRequest() + public function testMakeRequest(): void { $response = HttpFactory::makeRequest('GET', 'path.json', 'application/json', 'content'); diff --git a/tests/Unit/Http/HttpFactory/MakeResponseTest.php b/tests/Unit/Http/HttpFactory/MakeResponseTest.php index d54ddf04..ef70a6d1 100644 --- a/tests/Unit/Http/HttpFactory/MakeResponseTest.php +++ b/tests/Unit/Http/HttpFactory/MakeResponseTest.php @@ -12,7 +12,7 @@ #[CoversClass(HttpFactory::class)] class MakeResponseTest extends TestCase { - public function testMakeResponse() + public function testMakeResponse(): void { $response = HttpFactory::makeResponse(200, 'application/json', 'content'); diff --git a/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php b/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php index b11adf4d..42f57a51 100644 --- a/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php +++ b/tests/Unit/Http/HttpFactory/MakeXmlRequestTest.php @@ -12,7 +12,7 @@ #[CoversClass(HttpFactory::class)] class MakeXmlRequestTest extends TestCase { - public function testMakeXmlRequest() + public function testMakeXmlRequest(): void { $response = HttpFactory::makeXmlRequest('GET', 'path.xml', 'content'); diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 1b9d5a93..81f7df7c 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -63,7 +63,7 @@ public static function getEncodedToNormalizedData(): array * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected) + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void { $serializer = JsonSerializer::createFromString($data); @@ -88,7 +88,7 @@ public static function getInvalidEncodedData(): array * @dataProvider getInvalidEncodedData */ #[DataProvider('getInvalidEncodedData')] - public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data) + public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data): void { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); @@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, $expected) + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void { $serializer = JsonSerializer::createFromArray($data); @@ -205,7 +205,7 @@ public static function getInvalidSerializedData(): array * @dataProvider getInvalidSerializedData */ #[DataProvider('getInvalidSerializedData')] - public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data) + public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data): void { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); diff --git a/tests/Unit/Serializer/PathSerializerTest.php b/tests/Unit/Serializer/PathSerializerTest.php index ec6292fd..340d6177 100644 --- a/tests/Unit/Serializer/PathSerializerTest.php +++ b/tests/Unit/Serializer/PathSerializerTest.php @@ -54,7 +54,7 @@ public static function getPathData(): array * @dataProvider getPathData */ #[DataProvider('getPathData')] - public function testGetPathShouldReturnExpectedString(string $path, array $params, string $expected) + public function testGetPathShouldReturnExpectedString(string $path, array $params, string $expected): void { $serializer = PathSerializer::create($path, $params); diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index 4e5953b4..a8e126ee 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -17,7 +17,7 @@ class XmlSerializerTest extends TestCase * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected) + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void { $serializer = XmlSerializer::createFromString($data); @@ -77,7 +77,7 @@ public static function getEncodedToNormalizedData(): array * @dataProvider getInvalidEncodedData */ #[DataProvider('getInvalidEncodedData')] - public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data) + public function testCreateFromStringWithInvalidStringThrowsException(string $message, string $data): void { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); @@ -115,7 +115,7 @@ public static function getInvalidEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, $expected) + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void { $serializer = XmlSerializer::createFromArray($data); @@ -300,7 +300,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getInvalidSerializedData */ #[DataProvider('getInvalidSerializedData')] - public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data) + public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data): void { $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); From 9b8b71f5f0c036cf778499238f999428431e5a8e Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 10:09:16 +0200 Subject: [PATCH 4/9] Fix more phpstan level 6 errors --- .phpstan.neon | 2 +- src/Redmine/Client/ClientApiTrait.php | 3 +++ src/Redmine/Client/NativeCurlClient.php | 17 +++++++++++++++++ src/Redmine/Http/HttpFactory.php | 14 +++++++------- src/Redmine/Serializer/JsonSerializer.php | 5 +++++ src/Redmine/Serializer/PathSerializer.php | 6 ++++++ src/Redmine/Serializer/XmlSerializer.php | 20 +++++++++++++++++--- tests/Unit/Serializer/XmlSerializerTest.php | 10 +++++++++- 8 files changed, 65 insertions(+), 12 deletions(-) diff --git a/.phpstan.neon b/.phpstan.neon index b05534e5..65eb63b4 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 5 + level: 6 paths: - src/ diff --git a/src/Redmine/Client/ClientApiTrait.php b/src/Redmine/Client/ClientApiTrait.php index 13d77a56..e23a314d 100644 --- a/src/Redmine/Client/ClientApiTrait.php +++ b/src/Redmine/Client/ClientApiTrait.php @@ -12,6 +12,9 @@ */ trait ClientApiTrait { + /** + * @var array + */ private array $apiInstances = []; private array $apiClassnames = [ diff --git a/src/Redmine/Client/NativeCurlClient.php b/src/Redmine/Client/NativeCurlClient.php index 8eff3da3..ccabb429 100644 --- a/src/Redmine/Client/NativeCurlClient.php +++ b/src/Redmine/Client/NativeCurlClient.php @@ -24,8 +24,20 @@ final class NativeCurlClient implements Client, HttpClient private int $lastResponseStatusCode = 0; private string $lastResponseContentType = ''; private string $lastResponseBody = ''; + + /** + * @var array + */ private array $curlOptions = []; + + /** + * @var array + */ private array $httpHeaders = []; + + /** + * @var array + */ private array $httpHeadersNames = []; private ?int $port = null; @@ -194,6 +206,8 @@ public function unsetCurlOption(int $option): void /** * Set multiple HTTP headers. + * + * @param array $headers */ private function setHttpHeaders(array $headers): void { @@ -339,6 +353,9 @@ private function createCurl(string $method, string $path, string $body = '', str return $curl; } + /** + * @return array + */ private function createHttpHeader(string $path, string $contentType = ''): array { // Additional request headers diff --git a/src/Redmine/Http/HttpFactory.php b/src/Redmine/Http/HttpFactory.php index 47222037..039ca39a 100644 --- a/src/Redmine/Http/HttpFactory.php +++ b/src/Redmine/Http/HttpFactory.php @@ -14,9 +14,9 @@ final class HttpFactory public static function makeResponse(int $statusCode, string $contentType, string $content): Response { return new class ($statusCode, $contentType, $content) implements Response { - private $statusCode; - private $contentType; - private $body; + private int $statusCode; + private string $contentType; + private string $body; public function __construct(int $statusCode, string $contentType, string $body) { @@ -45,10 +45,10 @@ public function getContent(): string public static function makeRequest(string $method, string $path, string $contentType = '', string $content = ''): Request { return new class ($method, $path, $contentType, $content) implements Request { - private $method; - private $path; - private $contentType; - private $content; + private string $method; + private string $path; + private string $contentType; + private string $content; public function __construct(string $method, string $path, string $contentType, string $content) { diff --git a/src/Redmine/Serializer/JsonSerializer.php b/src/Redmine/Serializer/JsonSerializer.php index b91f5342..134794e4 100644 --- a/src/Redmine/Serializer/JsonSerializer.php +++ b/src/Redmine/Serializer/JsonSerializer.php @@ -23,6 +23,8 @@ public static function createFromString(string $data): self } /** + * @param array $data + * * @throws SerializerException if $data could not be serialized to JSON */ public static function createFromArray(array $data): self @@ -77,6 +79,9 @@ private function decode(string $encoded): void } } + /** + * @param array $normalized + */ private function encode(array $normalized): void { $this->normalized = $normalized; diff --git a/src/Redmine/Serializer/PathSerializer.php b/src/Redmine/Serializer/PathSerializer.php index bf5505d8..c0191472 100644 --- a/src/Redmine/Serializer/PathSerializer.php +++ b/src/Redmine/Serializer/PathSerializer.php @@ -9,6 +9,9 @@ */ final class PathSerializer implements Stringable { + /** + * @param array $queryParams + */ public static function create(string $path, array $queryParams = []): self { $serializer = new self(); @@ -20,6 +23,9 @@ public static function create(string $path, array $queryParams = []): self private string $path; + /** + * @var array + */ private array $queryParams; private function __construct() diff --git a/src/Redmine/Serializer/XmlSerializer.php b/src/Redmine/Serializer/XmlSerializer.php index c8e9ed17..f0b10050 100644 --- a/src/Redmine/Serializer/XmlSerializer.php +++ b/src/Redmine/Serializer/XmlSerializer.php @@ -25,6 +25,8 @@ public static function createFromString(string $data): self } /** + * @param array $data + * * @throws SerializerException if $data could not be serialized to XML */ public static function createFromArray(array $data): self @@ -105,6 +107,11 @@ private function normalize(SimpleXMLElement $deserialized): void $this->normalized = JsonSerializer::createFromString($serialized)->getNormalized(); } + /** + * @param array $normalized + * + * @throws SerializerException + */ private function denormalize(array $normalized): void { $this->normalized = $normalized; @@ -136,7 +143,10 @@ private function denormalize(array $normalized): void $this->encoded = $this->deserialized->asXml(); } - private function createXmlElement(string $rootElementName, $params): SimpleXMLElement + /** + * @param array $params + */ + private function createXmlElement(string $rootElementName, array $params): SimpleXMLElement { $value = ''; if (! is_array($params)) { @@ -154,6 +164,10 @@ private function createXmlElement(string $rootElementName, $params): SimpleXMLEl return $xml; } + /** + * @param string|int $k + * @param mixed $v + */ private function addChildToXmlElement(SimpleXMLElement $xml, $k, $v): void { $specialParams = [ @@ -196,8 +210,8 @@ private function addChildToXmlElement(SimpleXMLElement $xml, $k, $v): void /** * Attaches Custom Fields to XML element. * - * @param SimpleXMLElement $xml XML Element the custom fields are attached to - * @param array $fields array of fields to attach, each field needs name, id and value set + * @param SimpleXMLElement $xml XML Element the custom fields are attached to + * @param array> $fields array of fields to attach, each field needs name, id and value set * * @see http://www.redmine.org/projects/redmine/wiki/Rest_api#Working-with-custom-fields */ diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index a8e126ee..8a96f85b 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -122,6 +122,9 @@ public function testCreateFromArrayEncodesToExpectedString(array $data, $expecte $this->assertXmlStringEqualsXmlString($expected, $serializer->__toString()); } + /** + * @return array + */ public static function getNormalizedToEncodedData(): array { return [ @@ -298,6 +301,8 @@ public static function getNormalizedToEncodedData(): array /** * @dataProvider getInvalidSerializedData + * + * @param array $data */ #[DataProvider('getInvalidSerializedData')] public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data): void @@ -308,9 +313,12 @@ public function testCreateFromArrayWithInvalidDataThrowsException(string $messag XmlSerializer::createFromArray($data); } + /** + * @return array + */ public static function getInvalidSerializedData(): array { - return[ + return [ 'invalid element name as start tag' => [ 'Could not create XML from array: "StartTag: invalid element name' . "\n" . '", "Extra content at the end of the document' . "\n" . '"', ['0' => ['foobar']], From cfcaaa0a911c546a2dc3342f5ae977a87ee39fd7 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 11:48:11 +0200 Subject: [PATCH 5/9] Fix all PHPStan level 6 errors in src folder --- src/Redmine/Api/AbstractApi.php | 25 ++++++---- src/Redmine/Api/Attachment.php | 15 +++--- src/Redmine/Api/CustomField.php | 31 ++++++++---- src/Redmine/Api/Group.php | 27 +++++++---- src/Redmine/Api/Issue.php | 39 ++++++++------- src/Redmine/Api/IssueCategory.php | 42 ++++++++++------ src/Redmine/Api/IssuePriority.php | 11 +++-- src/Redmine/Api/IssueRelation.php | 23 +++++---- src/Redmine/Api/IssueStatus.php | 21 +++++--- src/Redmine/Api/Membership.php | 29 ++++++----- src/Redmine/Api/News.php | 19 ++++---- src/Redmine/Api/Project.php | 46 +++++++++++------- src/Redmine/Api/Query.php | 11 +++-- src/Redmine/Api/Role.php | 18 ++++--- src/Redmine/Api/Search.php | 15 +++--- src/Redmine/Api/TimeEntry.php | 18 ++++--- src/Redmine/Api/TimeEntryActivity.php | 21 +++++--- src/Redmine/Api/Tracker.php | 21 +++++--- src/Redmine/Api/User.php | 46 +++++++++++------- src/Redmine/Api/Version.php | 69 ++++++++++++++++++--------- src/Redmine/Api/Wiki.php | 29 ++++++----- src/Redmine/Client/ClientApiTrait.php | 45 +++++++++-------- 22 files changed, 384 insertions(+), 237 deletions(-) diff --git a/src/Redmine/Api/AbstractApi.php b/src/Redmine/Api/AbstractApi.php index 934e2811..db6a086e 100644 --- a/src/Redmine/Api/AbstractApi.php +++ b/src/Redmine/Api/AbstractApi.php @@ -108,7 +108,7 @@ public function lastCallFailed() * @param string $path * @param bool $decodeIfJson * - * @return string|array|SimpleXMLElement|false + * @return string|array|SimpleXMLElement|false */ protected function get($path, $decodeIfJson = true) { @@ -245,7 +245,10 @@ protected function isNotNull($var) } /** - * @return array + * @param array $defaults + * @param array $params + * + * @return array */ protected function sanitizeParams(array $defaults, array $params) { @@ -262,10 +265,10 @@ protected function sanitizeParams(array $defaults, array $params) * @deprecated v2.2.0 Use `retrieveData()` instead * @see AbstractApi::retrieveData() * - * @param string $endpoint API end point - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string $endpoint API end point + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false elements found or error message or false + * @return array|string|false elements found or error message or false */ protected function retrieveAll($endpoint, array $params = []) { @@ -288,12 +291,12 @@ protected function retrieveAll($endpoint, array $params = []) * Retrieves as many elements as you want of a given endpoint (even if the * total number of elements is greater than 100). * - * @param string $endpoint API end point - * @param array $params optional query parameters to be passed to the api (offset, limit, ...) + * @param string $endpoint API end point + * @param array $params optional query parameters to be passed to the api (offset, limit, ...) * * @throws SerializerException if response body could not be converted into array * - * @return array elements found + * @return array elements found */ protected function retrieveData(string $endpoint, array $params = []): array { @@ -364,7 +367,7 @@ protected function retrieveData(string $endpoint, array $params = []): array * @see \Redmine\Serializer\XmlSerializer::createFromArray() * * @param SimpleXMLElement $xml XML Element the custom fields are attached to - * @param array $fields array of fields to attach, each field needs name, id and value set + * @param array $fields array of fields to attach, each field needs name, id and value set * * @return SimpleXMLElement $xml * @@ -411,6 +414,8 @@ protected function attachCustomFieldXML(SimpleXMLElement $xml, array $fields) * returns the last response body as array. * * @throws SerializerException if response body could not be converted into array + * + * @return array */ private function getResponseAsArray(Response $response): array { @@ -435,7 +440,7 @@ private function getResponseAsArray(Response $response): array private function handleClient(Client $client): HttpClient { return new class ($client) implements HttpClient { - private $client; + private Client $client; public function __construct(Client $client) { diff --git a/src/Redmine/Api/Attachment.php b/src/Redmine/Api/Attachment.php index 3e030ef4..fb9fd8c4 100644 --- a/src/Redmine/Api/Attachment.php +++ b/src/Redmine/Api/Attachment.php @@ -7,7 +7,6 @@ use Redmine\Http\HttpFactory; use Redmine\Serializer\JsonSerializer; use Redmine\Serializer\PathSerializer; -use SimpleXMLElement; /** * Attachment details. @@ -25,7 +24,7 @@ class Attachment extends AbstractApi * * @param int $id the attachment number * - * @return array|false|string information about the attachment as array or false|string on error + * @return array|false|string information about the attachment as array or false|string on error */ public function show($id) { @@ -52,10 +51,10 @@ public function show($id) * * @see https://www.redmine.org/projects/redmine/wiki/Rest_Attachments#PATCH * - * @param int $id the attachment id - * @param array $params available $params: - * - filename: filename of the attachment - * - description: new description of the attachment + * @param int $id the attachment id + * @param array $params available $params: + * - filename: filename of the attachment + * - description: new description of the attachment * * @throws SerializerException if $params contains invalid values * @throws UnexpectedResponseException if the Redmine server delivers an unexpected response @@ -108,8 +107,8 @@ public function download($id) * available $params : * - filename: filename of the attachment * - * @param string $attachment the attachment content - * @param array $params optional parameters to be passed to the api + * @param string $attachment the attachment content + * @param array $params optional parameters to be passed to the api * * @return string information about the attachment */ diff --git a/src/Redmine/Api/CustomField.php b/src/Redmine/Api/CustomField.php index da88d5b6..bbd8e799 100644 --- a/src/Redmine/Api/CustomField.php +++ b/src/Redmine/Api/CustomField.php @@ -15,8 +15,14 @@ */ class CustomField extends AbstractApi { + /** + * @var array + */ private $customFields = []; + /** + * @var null|array + */ private $customFieldNames = null; /** @@ -24,11 +30,11 @@ class CustomField extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_CustomFields#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of custom fields found + * @return array list of custom fields found */ final public function list(array $params = []): array { @@ -71,9 +77,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_CustomFields#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of custom fields found or error message or false + * @return array|string|false list of custom fields found or error message or false */ public function all(array $params = []) { @@ -102,10 +108,10 @@ public function all(array $params = []) * @deprecated v2.7.0 Use listNames() instead. * @see CustomField::listNames() * - * @param bool $forceUpdate to force the update of the custom fields var - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param bool $forceUpdate to force the update of the custom fields var + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array list of custom fields (id => name) + * @return array list of custom fields (name => id) */ public function listing($forceUpdate = false, array $params = []) { @@ -120,8 +126,8 @@ public function listing($forceUpdate = false, array $params = []) * @deprecated v2.7.0 Use listNames() instead. * @see CustomField::listNames() * - * @param string|int $name customer field name - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $name customer field name + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @return int|false */ @@ -138,7 +144,12 @@ public function getIdByName($name, array $params = []) return $arr[(string) $name]; } - private function doListing(bool $forceUpdate, array $params) + /** + * @param array $params + * + * @return array + */ + private function doListing(bool $forceUpdate, array $params): array { if (empty($this->customFields) || $forceUpdate) { $this->customFields = $this->list($params); diff --git a/src/Redmine/Api/Group.php b/src/Redmine/Api/Group.php index e8cd0bae..04d10064 100644 --- a/src/Redmine/Api/Group.php +++ b/src/Redmine/Api/Group.php @@ -21,8 +21,14 @@ */ class Group extends AbstractApi { + /** + * @var array + */ private $groups = []; + /** + * @var null|array + */ private $groupNames = null; /** @@ -30,11 +36,11 @@ class Group extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of groups found + * @return array list of groups found */ final public function list(array $params = []): array { @@ -73,9 +79,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of groups found or error message or false + * @return array|string|false list of groups found or error message or false */ public function all(array $params = []) { @@ -106,7 +112,7 @@ public function all(array $params = []) * * @param bool $forceUpdate to force the update of the groups var * - * @return array list of groups (id => name) + * @return array list of groups (name => id) */ public function listing($forceUpdate = false) { @@ -128,7 +134,7 @@ public function listing($forceUpdate = false) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Groups#POST * - * @param array $params the new group data + * @param array $params the new group data * * @throws MissingParameterException Missing mandatory parameters * @@ -170,7 +176,8 @@ public function create(array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Groups#PUT * - * @param int $id the group id + * @param int $id the group id + * @param array $params * * @return string empty string */ @@ -198,10 +205,10 @@ public function update(int $id, array $params = []) * available $params : * - include: a coma separated list of associations to include in the response: users,memberships * - * @param int $id the group id - * @param array $params params to pass to url + * @param int $id the group id + * @param array $params params to pass to url * - * @return array|false|string information about the group as array or false|string on error + * @return array|false|string information about the group as array or false|string on error */ public function show($id, array $params = []) { diff --git a/src/Redmine/Api/Issue.php b/src/Redmine/Api/Issue.php index fde13968..3b052777 100644 --- a/src/Redmine/Api/Issue.php +++ b/src/Redmine/Api/Issue.php @@ -87,11 +87,11 @@ class Issue extends AbstractApi * - cf_x: get issues with the given value for custom field with an ID of x. (Custom field must have 'used as a filter' checked.) * - query_id : id of the previously saved query * - * @param array $params the additional parameters (cf available $params above) + * @param array $params the additional parameters (cf available $params above) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of issues found + * @return array list of issues found */ final public function list(array $params = []): array { @@ -120,9 +120,9 @@ final public function list(array $params = []): array * - cf_x: get issues with the given value for custom field with an ID of x. (Custom field must have 'used as a filter' checked.) * - query_id : id of the previously saved query * - * @param array $params the additional parameters (cf available $params above) + * @param array $params the additional parameters (cf available $params above) * - * @return array|string|false list of issues found or error message or false + * @return array|string|false list of issues found or error message or false */ public function all(array $params = []) { @@ -150,10 +150,10 @@ public function all(array $params = []) * available $params : * include: fetch associated data (optional). Possible values: children, attachments, relations, changesets and journals * - * @param int $id the issue id - * @param array $params extra associated data + * @param int $id the issue id + * @param array $params extra associated data * - * @return array|false|string information about the issue as array or false|string on error + * @return array|false|string information about the issue as array or false|string on error */ public function show($id, array $params = []) { @@ -185,7 +185,7 @@ public function show($id, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Creating-an-issue * - * @param array $params the new issue data + * @param array $params the new issue data * * @return string|SimpleXMLElement|false */ @@ -234,7 +234,8 @@ public function create(array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue * - * @param int $id the issue number + * @param int $id the issue number + * @param array $params * * @return string|SimpleXMLElement|false */ @@ -341,9 +342,11 @@ public function addNoteToIssue($id, $note, $privateNote = false) /** * Transforms literal identifiers to integer ids. * - * @return array + * @param array $params + * + * @return array */ - private function cleanParams(array $params = []) + private function cleanParams(array $params = []): array { if (isset($params['project'])) { $projectApi = $this->getProjectApi(); @@ -420,8 +423,8 @@ private function cleanParams(array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue * - * @param int $id the issue number - * @param array $attachment ['token' => '...', 'filename' => '...', 'content_type' => '...'] + * @param int $id the issue number + * @param array $attachment ['token' => '...', 'filename' => '...', 'content_type' => '...'] * * @return bool|string */ @@ -435,11 +438,11 @@ public function attach($id, array $attachment) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue * - * @param int $id the issue number - * @param array $attachments [ - * ['token' => '...', 'filename' => '...', 'content_type' => '...'], - * ['token' => '...', 'filename' => '...', 'content_type' => '...'] - * ] + * @param int $id the issue number + * @param array $attachments [ + * ['token' => '...', 'filename' => '...', 'content_type' => '...'], + * ['token' => '...', 'filename' => '...', 'content_type' => '...'] + * ] * * @return bool|string */ diff --git a/src/Redmine/Api/IssueCategory.php b/src/Redmine/Api/IssueCategory.php index b86f9df4..fa16fb39 100644 --- a/src/Redmine/Api/IssueCategory.php +++ b/src/Redmine/Api/IssueCategory.php @@ -22,8 +22,14 @@ */ class IssueCategory extends AbstractApi { + /** + * @var array + */ private $issueCategories = []; + /** + * @var array + */ private $issueCategoriesNames = []; /** @@ -31,13 +37,13 @@ class IssueCategory extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#GET * - * @param string|int $projectIdentifier project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $projectIdentifier project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws InvalidParameterException if $projectIdentifier is not of type int or string * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of issue categories found + * @return array list of issue categories found */ final public function listByProject($projectIdentifier, array $params = []): array { @@ -98,10 +104,10 @@ final public function listNamesByProject($projectIdentifier): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#GET * - * @param string|int $project project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of issue categories found or error message or false + * @return array|string|false list of issue categories found or error message or false */ public function all($project, array $params = []) { @@ -131,7 +137,7 @@ public function all($project, array $params = []) * @param string|int $project project id or literal identifier * @param bool $forceUpdate to force the update of the projects var * - * @return array list of projects (id => project name) + * @return array list of projects (project name => id) */ public function listing($project, $forceUpdate = false) { @@ -171,7 +177,7 @@ public function getIdByName($project, $name) * * @param int $id the issue category id * - * @return array|false|string information about the category as array or false|string on error + * @return array|false|string information about the category as array or false|string on error */ public function show($id) { @@ -198,8 +204,8 @@ public function show($id) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#POST * - * @param string|int $project project id or literal identifier - * @param array $params the new issue category data + * @param string|int $project project id or literal identifier + * @param array $params the new issue category data * * @throws MissingParameterException Missing mandatory parameters * @@ -239,7 +245,8 @@ public function create($project, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#PUT * - * @param int $id the issue category id + * @param int $id the issue category id + * @param array $params * * @return string|false */ @@ -267,8 +274,8 @@ public function update($id, array $params) * available $params : * - reassign_to_id : when there are issues assigned to the category you are deleting, this parameter lets you reassign these issues to the category with this id * - * @param int $id id of the category - * @param array $params extra GET parameters + * @param int $id id of the category + * @param array $params extra GET parameters * * @return string empty string on success */ @@ -282,10 +289,15 @@ public function remove($id, array $params = []) return $this->lastResponse->getContent(); } - private function doListing($project, bool $forceUpdate) + /** + * @param int|string $projectIdentifier + * + * @return array + */ + private function doListing($projectIdentifier, bool $forceUpdate): array { if (true === $forceUpdate || empty($this->issueCategories)) { - $this->issueCategories = $this->listByProject($project); + $this->issueCategories = $this->listByProject($projectIdentifier); } $ret = []; diff --git a/src/Redmine/Api/IssuePriority.php b/src/Redmine/Api/IssuePriority.php index 0d08a77f..6a6ca25b 100644 --- a/src/Redmine/Api/IssuePriority.php +++ b/src/Redmine/Api/IssuePriority.php @@ -15,6 +15,9 @@ */ class IssuePriority extends AbstractApi { + /** + * @var array + */ private $issuePriorities = []; /** @@ -22,11 +25,11 @@ class IssuePriority extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Enumerations#enumerationsissue_prioritiesformat * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of issue priorities found + * @return array list of issue priorities found */ final public function list(array $params = []): array { @@ -45,9 +48,9 @@ final public function list(array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Enumerations#enumerationsissue_prioritiesformat * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of issue priorities found or error message or false + * @return array|string|false list of issue priorities found or error message or false */ public function all(array $params = []) { diff --git a/src/Redmine/Api/IssueRelation.php b/src/Redmine/Api/IssueRelation.php index d7529a87..36849c3e 100644 --- a/src/Redmine/Api/IssueRelation.php +++ b/src/Redmine/Api/IssueRelation.php @@ -18,6 +18,9 @@ */ class IssueRelation extends AbstractApi { + /** + * @var array + */ private $relations = []; /** @@ -25,12 +28,12 @@ class IssueRelation extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#GET * - * @param int $issueId the issue id - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param int $issueId the issue id + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of relations found + * @return array list of relations found */ final public function listByIssueId(int $issueId, array $params = []): array { @@ -49,10 +52,10 @@ final public function listByIssueId(int $issueId, array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#GET * - * @param int $issueId the issue id - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param int $issueId the issue id + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of relations found or error message or false + * @return array|string|false list of relations found or error message or false */ public function all($issueId, array $params = []) { @@ -82,7 +85,7 @@ public function all($issueId, array $params = []) * * @param int $id the relation id * - * @return array relation's details or empty array on error + * @return array relation's details or empty array on error */ public function show($id) { @@ -140,12 +143,12 @@ public function remove($id) * (in: "relates", "duplicates", "duplicated", "blocks", "blocked", "precedes", "follows", "copied_to", "copied_from") * - delay (optional): the delay for a "precedes" or "follows" relation * - * @param int $issueId the ID of the issue we are creating the relation on - * @param array $params the new issue relation data + * @param int $issueId the ID of the issue we are creating the relation on + * @param array $params the new issue relation data * * @throws MissingParameterException Missing mandatory parameters * - * @return array + * @return array */ public function create($issueId, array $params = []) { diff --git a/src/Redmine/Api/IssueStatus.php b/src/Redmine/Api/IssueStatus.php index a587705c..293ed989 100644 --- a/src/Redmine/Api/IssueStatus.php +++ b/src/Redmine/Api/IssueStatus.php @@ -15,8 +15,14 @@ */ class IssueStatus extends AbstractApi { + /** + * @var array + */ private $issueStatuses = []; + /** + * @var array + */ private $issueStatusNames = null; /** @@ -24,11 +30,11 @@ class IssueStatus extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueStatuses#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of issue statuses found + * @return array list of issue statuses found */ final public function list(array $params = []): array { @@ -71,9 +77,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_IssueStatuses#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of issue statuses found or error message or false + * @return array|string|false list of issue statuses found or error message or false */ public function all(array $params = []) { @@ -104,7 +110,7 @@ public function all(array $params = []) * * @param bool $forceUpdate to force the update of the statuses var * - * @return array list of issue statuses (id => name) + * @return array list of issue statuses (name => id) */ public function listing($forceUpdate = false) { @@ -136,7 +142,10 @@ public function getIdByName($name) return $arr[(string) $name]; } - private function doListing(bool $forceUpdate) + /** + * @return array + */ + private function doListing(bool $forceUpdate): array { if (empty($this->issueStatuses) || $forceUpdate) { $this->issueStatuses = $this->list(); diff --git a/src/Redmine/Api/Membership.php b/src/Redmine/Api/Membership.php index 15f25618..81dc3de0 100644 --- a/src/Redmine/Api/Membership.php +++ b/src/Redmine/Api/Membership.php @@ -20,6 +20,9 @@ */ class Membership extends AbstractApi { + /** + * @var array + */ private $memberships = []; /** @@ -27,13 +30,13 @@ class Membership extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET * - * @param string|int $projectIdentifier project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $projectIdentifier project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws InvalidParameterException if $projectIdentifier is not of type int or string * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of memberships found + * @return array list of memberships found */ final public function listByProject($projectIdentifier, array $params = []): array { @@ -59,10 +62,10 @@ final public function listByProject($projectIdentifier, array $params = []): arr * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET * - * @param string|int $project project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of memberships found or error message or false + * @return array|string|false list of memberships found or error message or false */ public function all($project, array $params = []) { @@ -90,8 +93,8 @@ public function all($project, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#POST * - * @param string|int $project project id or literal identifier - * @param array $params the new membership data + * @param string|int $project project id or literal identifier + * @param array $params the new membership data * * @throws MissingParameterException Missing mandatory parameters * @@ -129,8 +132,8 @@ public function create($project, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#PUT * - * @param int $id id of the membership - * @param array $params the new membership data + * @param int $id id of the membership + * @param array $params the new membership data * * @throws MissingParameterException Missing mandatory parameters * @@ -180,9 +183,9 @@ public function remove($id) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Memberships#DELETE * - * @param int $projectId id of project - * @param int $userId id of user - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param int $projectId id of project + * @param int $userId id of user + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @return false|\SimpleXMLElement|string */ diff --git a/src/Redmine/Api/News.php b/src/Redmine/Api/News.php index ffde4da4..629fdcb1 100644 --- a/src/Redmine/Api/News.php +++ b/src/Redmine/Api/News.php @@ -14,6 +14,9 @@ */ class News extends AbstractApi { + /** + * @var array + */ private $news = []; /** @@ -21,13 +24,13 @@ class News extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_News#GET * - * @param string|int $projectIdentifier project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $projectIdentifier project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws InvalidParameterException if $projectIdentifier is not of type int or string * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of news found + * @return array list of news found */ final public function listByProject($projectIdentifier, array $params = []): array { @@ -50,11 +53,11 @@ final public function listByProject($projectIdentifier, array $params = []): arr * * @see http://www.redmine.org/projects/redmine/wiki/Rest_News#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of news found + * @return array list of news found */ final public function list(array $params = []): array { @@ -74,10 +77,10 @@ final public function list(array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_News#GET * - * @param string|int $project project id or literal identifier [optional] - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier [optional] + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of news found or error message or false + * @return array|string|false list of news found or error message or false */ public function all($project = null, array $params = []) { diff --git a/src/Redmine/Api/Project.php b/src/Redmine/Api/Project.php index 62f83f11..50ed0c46 100755 --- a/src/Redmine/Api/Project.php +++ b/src/Redmine/Api/Project.php @@ -22,8 +22,14 @@ */ class Project extends AbstractApi { + /** + * @var array + */ private $projects = []; + /** + * @var null|array + */ private $projectNames = null; /** @@ -31,11 +37,11 @@ class Project extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Projects * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of projects found + * @return array list of projects found */ final public function list(array $params = []): array { @@ -91,9 +97,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Projects * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of projects found or error message or false + * @return array|string|false list of projects found or error message or false */ public function all(array $params = []) { @@ -122,11 +128,11 @@ public function all(array $params = []) * @deprecated v2.7.0 Use listNames() instead. * @see Project::listNames() * - * @param bool $forceUpdate to force the update of the projects var - * @param bool $reverse to return an array indexed by name rather than id - * @param array $params to allow offset/limit (and more) to be passed + * @param bool $forceUpdate to force the update of the projects var + * @param bool $reverse to return an array indexed by name rather than id + * @param array $params to allow offset/limit (and more) to be passed * - * @return array list of projects (id => project name) + * @return array list of projects (id => project name | project name => id) */ public function listing($forceUpdate = false, $reverse = true, array $params = []) { @@ -141,8 +147,8 @@ public function listing($forceUpdate = false, $reverse = true, array $params = [ * @deprecated v2.7.0 Use listNames() instead. * @see Project::listNames() * - * @param string $name - * @param array $params to allow offset/limit (and more) to be passed + * @param string $name + * @param array $params to allow offset/limit (and more) to be passed * * @return int|bool */ @@ -164,11 +170,11 @@ public function getIdByName($name, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Showing-a-project * - * @param string|int $id project id or identifier - * @param array $params available parameters: - * include: fetch associated data (optional). Possible values: trackers, issue_categories, enabled_modules (since 2.6.0) + * @param string|int $id project id or identifier + * @param array $params available parameters: + * include: fetch associated data (optional). Possible values: trackers, issue_categories, enabled_modules (since 2.6.0) * - * @return array|false|string information about the project as array or false|string on error + * @return array|false|string information about the project as array or false|string on error */ public function show($id, array $params = []) { @@ -201,7 +207,7 @@ public function show($id, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Projects * - * @param array $params the new project data + * @param array $params the new project data * * @throws MissingParameterException * @@ -244,6 +250,7 @@ public function create(array $params = []) * @see http://www.redmine.org/projects/redmine/wiki/Rest_Projects * * @param string|int $id project id or identifier + * @param array $params * * @return string|false */ @@ -414,7 +421,7 @@ final public function unarchive($projectIdentifier): bool * @deprecated v2.3.0 Use `\Redmine\Serializer\XmlSerializer::createFromArray()` instead. * @see \Redmine\Serializer\XmlSerializer::createFromArray() * - * @param array $params + * @param array $params * * @return \SimpleXMLElement */ @@ -446,7 +453,12 @@ public function remove($id) return $this->lastResponse->getContent(); } - private function doListing(bool $forceUpdate, bool $reverse, array $params) + /** + * @param array $params + * + * @return array + */ + private function doListing(bool $forceUpdate, bool $reverse, array $params): array { if (true === $forceUpdate || empty($this->projects)) { $this->projects = $this->list($params); diff --git a/src/Redmine/Api/Query.php b/src/Redmine/Api/Query.php index 4db772fc..35232c6a 100644 --- a/src/Redmine/Api/Query.php +++ b/src/Redmine/Api/Query.php @@ -15,6 +15,9 @@ */ class Query extends AbstractApi { + /** + * @var array + */ private $query = []; /** @@ -22,11 +25,11 @@ class Query extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Queries#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of queries found + * @return array list of queries found */ final public function list(array $params = []): array { @@ -45,9 +48,9 @@ final public function list(array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Queries#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of queries found or error message or false + * @return array|string|false list of queries found or error message or false */ public function all(array $params = []) { diff --git a/src/Redmine/Api/Role.php b/src/Redmine/Api/Role.php index 57ae428f..8e61cb85 100644 --- a/src/Redmine/Api/Role.php +++ b/src/Redmine/Api/Role.php @@ -17,8 +17,14 @@ */ class Role extends AbstractApi { + /** + * @var array + */ private $roles = []; + /** + * @var null|array + */ private $roleNames = null; /** @@ -26,11 +32,11 @@ class Role extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Roles#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of roles found + * @return array list of roles found */ final public function list(array $params = []): array { @@ -72,9 +78,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Roles#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of roles found or error message or false + * @return array|string|false list of roles found or error message or false */ public function all(array $params = []) { @@ -105,7 +111,7 @@ public function all(array $params = []) * * @param bool $forceUpdate to force the update of the roles var * - * @return array list of roles (id => name) + * @return array list of roles (name => id) */ public function listing($forceUpdate = false) { @@ -129,7 +135,7 @@ public function listing($forceUpdate = false) * * @param int $id the role id * - * @return array|false|string information about the role as array or false|string on error + * @return array|false|string information about the role as array or false|string on error */ public function show($id) { diff --git a/src/Redmine/Api/Search.php b/src/Redmine/Api/Search.php index ff823952..0b31e2a0 100644 --- a/src/Redmine/Api/Search.php +++ b/src/Redmine/Api/Search.php @@ -11,6 +11,9 @@ */ class Search extends AbstractApi { + /** + * @var array + */ private $results = []; /** @@ -18,12 +21,12 @@ class Search extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Search * - * @param string $query string to search - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string $query string to search + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of results (projects, issues) + * @return array list of results (projects, issues) */ final public function listByQuery(string $query, array $params = []): array { @@ -44,10 +47,10 @@ final public function listByQuery(string $query, array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Search * - * @param string $query string to search - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string $query string to search + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of results (projects, issues) found or error message or false + * @return array|string|false list of results (projects, issues) found or error message or false */ public function search($query, array $params = []) { diff --git a/src/Redmine/Api/TimeEntry.php b/src/Redmine/Api/TimeEntry.php index d419b34b..5ad6e088 100644 --- a/src/Redmine/Api/TimeEntry.php +++ b/src/Redmine/Api/TimeEntry.php @@ -20,6 +20,9 @@ */ class TimeEntry extends AbstractApi { + /** + * @var array + */ private $timeEntries = []; /** @@ -27,11 +30,11 @@ class TimeEntry extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of time entries found + * @return array list of time entries found */ final public function list(array $params = []): array { @@ -50,9 +53,9 @@ final public function list(array $params = []): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of time entries found or error message or false + * @return array|string|false list of time entries found or error message or false */ public function all(array $params = []) { @@ -82,7 +85,7 @@ public function all(array $params = []) * * @param int $id the time entry id * - * @return array|false|string information about the time entry as array or false|string on error + * @return array|false|string information about the time entry as array or false|string on error */ public function show($id) { @@ -109,7 +112,7 @@ public function show($id) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries * - * @param array $params the new time entry data + * @param array $params the new time entry data * * @throws MissingParameterException Missing mandatory parameters * @@ -154,7 +157,8 @@ public function create(array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries * - * @param int $id + * @param int $id + * @param array $params * * @return string|false */ diff --git a/src/Redmine/Api/TimeEntryActivity.php b/src/Redmine/Api/TimeEntryActivity.php index 93ea2a35..7cda0f09 100644 --- a/src/Redmine/Api/TimeEntryActivity.php +++ b/src/Redmine/Api/TimeEntryActivity.php @@ -15,18 +15,24 @@ */ class TimeEntryActivity extends AbstractApi { + /** + * @var array + */ private $timeEntryActivities = []; + /** + * @var null|array + */ private $timeEntryActivityNames = null; /** * List time entry activities. * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of time entry activities found + * @return array list of time entry activities found */ final public function list(array $params = []): array { @@ -66,9 +72,9 @@ final public function listNames(): array * @deprecated v2.4.0 Use list() instead. * @see TimeEntryActivity::list() * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of time entry activities found or error message or false + * @return array|string|false list of time entry activities found or error message or false */ public function all(array $params = []) { @@ -99,7 +105,7 @@ public function all(array $params = []) * * @param bool $forceUpdate to force the update of the statuses var * - * @return array list of time entry activities (id => name) + * @return array list of time entry activities (name => id) */ public function listing($forceUpdate = false) { @@ -131,7 +137,10 @@ public function getIdByName($name) return $arr[(string) $name]; } - private function doListing(bool $forceUpdate) + /** + * @return array + */ + private function doListing(bool $forceUpdate): array { if (empty($this->timeEntryActivities) || $forceUpdate) { $this->timeEntryActivities = $this->list(); diff --git a/src/Redmine/Api/Tracker.php b/src/Redmine/Api/Tracker.php index 72a46f4a..6d2c1ac1 100644 --- a/src/Redmine/Api/Tracker.php +++ b/src/Redmine/Api/Tracker.php @@ -15,8 +15,14 @@ */ class Tracker extends AbstractApi { + /** + * @var array + */ private $trackers = []; + /** + * @var null|array + */ private $trackerNames = null; /** @@ -24,11 +30,11 @@ class Tracker extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Trackers#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of trackers found + * @return array list of trackers found */ final public function list(array $params = []): array { @@ -70,9 +76,9 @@ final public function listNames(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Trackers#GET * - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of trackers found or error message or false + * @return array|string|false list of trackers found or error message or false */ public function all(array $params = []) { @@ -103,7 +109,7 @@ public function all(array $params = []) * * @param bool $forceUpdate to force the update of the trackers var * - * @return array list of trackers (id => name) + * @return array list of trackers (id => name) */ public function listing($forceUpdate = false) { @@ -135,7 +141,10 @@ public function getIdByName($name) return $arr[(string) $name]; } - private function doListing(bool $forceUpdate) + /** + * @return array + */ + private function doListing(bool $forceUpdate): array { if (empty($this->trackers) || $forceUpdate) { $this->trackers = $this->list(); diff --git a/src/Redmine/Api/User.php b/src/Redmine/Api/User.php index 027b7aca..dbec8396 100644 --- a/src/Redmine/Api/User.php +++ b/src/Redmine/Api/User.php @@ -21,8 +21,14 @@ */ class User extends AbstractApi { + /** + * @var array + */ private $users = []; + /** + * @var null|array + */ private $userLogins = null; /** @@ -30,11 +36,11 @@ class User extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Users#GET * - * @param array $params to allow offset/limit (and more) to be passed + * @param array $params to allow offset/limit (and more) to be passed * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of users found + * @return array list of users found */ final public function list(array $params = []): array { @@ -90,9 +96,9 @@ final public function listLogins(): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Users#GET * - * @param array $params to allow offset/limit (and more) to be passed + * @param array $params to allow offset/limit (and more) to be passed * - * @return array|string|false list of users found or error message or false + * @return array|string|false list of users found or error message or false */ public function all(array $params = []) { @@ -121,10 +127,10 @@ public function all(array $params = []) * @deprecated v2.7.0 Use listLogins() instead. * @see User::listLogins() * - * @param bool $forceUpdate to force the update of the users var - * @param array $params to allow offset/limit (and more) to be passed + * @param bool $forceUpdate to force the update of the users var + * @param array $params to allow offset/limit (and more) to be passed * - * @return array list of users (id => username) + * @return int[] list of users (username => id) */ public function listing($forceUpdate = false, array $params = []) { @@ -138,9 +144,9 @@ public function listing($forceUpdate = false, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Users#usersidformat * - * @param array $params extra associated data + * @param array $params extra associated data * - * @return array current user data + * @return array current user data */ public function getCurrentUser(array $params = []) { @@ -153,8 +159,8 @@ public function getCurrentUser(array $params = []) * @deprecated v2.7.0 Use listLogins() instead. * @see User::listLogins() * - * @param string $username - * @param array $params to allow offset/limit (and more) to be passed + * @param string $username + * @param array $params to allow offset/limit (and more) to be passed * * @return int|bool */ @@ -183,10 +189,10 @@ public function getIdByUsername($username, array $params = []) * - api_key: the API key of the user, visible for admins and for yourself (added in 2.3.0) * - status: a numeric id representing the status of the user, visible for admins only (added in 2.4.0) * - * @param int|string $id the user id or `current` for retrieving the user whose credentials are used - * @param array $params extra associated data + * @param int|string $id the user id or `current` for retrieving the user whose credentials are used + * @param array $params extra associated data * - * @return array|false|string information about the user as array or false|string on error + * @return array|false|string information about the user as array or false|string on error */ public function show($id, array $params = []) { @@ -225,7 +231,7 @@ public function show($id, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Users#POST * - * @param array $params the new user data + * @param array $params the new user data * * @throws MissingParameterException Missing mandatory parameters * @@ -271,7 +277,8 @@ public function create(array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Users#PUT * - * @param int $id the user id + * @param int $id the user id + * @param array $params * * @return string|false */ @@ -315,7 +322,12 @@ public function remove($id) return $this->lastResponse->getContent(); } - private function doListing(bool $forceUpdate, array $params) + /** + * @param array $params + * + * @return int[] + */ + private function doListing(bool $forceUpdate, array $params): array { if (empty($this->users) || $forceUpdate) { $this->users = $this->list($params); diff --git a/src/Redmine/Api/Version.php b/src/Redmine/Api/Version.php index 7d11cca2..5c355116 100644 --- a/src/Redmine/Api/Version.php +++ b/src/Redmine/Api/Version.php @@ -21,8 +21,14 @@ */ class Version extends AbstractApi { + /** + * @var array + */ private $versions = []; + /** + * @var array> + */ private $versionNames = []; /** @@ -30,12 +36,12 @@ class Version extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Versions#GET * - * @param string|int $projectIdentifier project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $projectIdentifier project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of versions found + * @return array>> list of versions found */ final public function listByProject($projectIdentifier, array $params = []): array { @@ -96,10 +102,10 @@ final public function listNamesByProject($projectIdentifier): array * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Versions#GET * - * @param string|int $project project id or literal identifier - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of versions found or error message or false + * @return array|string|false list of versions found or error message or false */ public function all($project, array $params = []) { @@ -128,12 +134,12 @@ public function all($project, array $params = []) * @deprecated v2.7.0 Use listNamesByProject() instead. * @see Version::listNamesByProject() * - * @param string|int $project project id or literal identifier - * @param bool $forceUpdate to force the update of the projects var - * @param bool $reverse to return an array indexed by name rather than id - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier + * @param bool $forceUpdate to force the update of the projects var + * @param bool $reverse to return an array indexed by name rather than id + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array list of versions (id => version name) + * @return array list of versions (id => version name) */ public function listing($project, $forceUpdate = false, $reverse = true, array $params = []) { @@ -148,9 +154,9 @@ public function listing($project, $forceUpdate = false, $reverse = true, array $ * @deprecated v2.7.0 Use listNamesByProject() instead. * @see Version::listNamesByProject() * - * @param string|int $project project id or literal identifier - * @param string $name The version name - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param string|int $project project id or literal identifier + * @param string $name The version name + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @return int|false */ @@ -174,7 +180,7 @@ public function getIdByName($project, $name, array $params = []) * * @param int $id the version id * - * @return array|false|string information about the version as array of false|string on error + * @return array|false|string information about the version as array of false|string on error */ public function show($id) { @@ -201,8 +207,8 @@ public function show($id) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Versions#POST * - * @param string|int $project project id or literal identifier - * @param array $params the new version data + * @param string|int $project project id or literal identifier + * @param array $params the new version data * * @throws MissingParameterException Missing mandatory parameters * @@ -247,7 +253,8 @@ public function create($project, array $params = []) * * @see http://www.redmine.org/projects/redmine/wiki/Rest_Versions#PUT * - * @param int $id the version id + * @param int $id the version id + * @param array $params * * @return string|false */ @@ -273,19 +280,30 @@ public function update($id, array $params) return $this->lastResponse->getContent(); } - private function validateStatus(array $params = []) + /** + * @param array $params + * + * @throws InvalidParameterException + */ + private function validateStatus(array $params = []): void { $arrStatus = [ 'open', 'locked', 'closed', ]; + if (isset($params['status']) && !in_array($params['status'], $arrStatus)) { throw new InvalidParameterException('Possible values for status are: ' . implode(', ', $arrStatus)); } } - private function validateSharing(array $params = []) + /** + * @param array $params + * + * @throws InvalidParameterException + */ + private function validateSharing(array $params = []): void { $arrSharing = [ 'none' => 'Not shared', @@ -294,6 +312,7 @@ private function validateSharing(array $params = []) 'tree' => 'With project tree', 'system' => 'With all projects', ]; + if (isset($params['sharing']) && !isset($arrSharing[$params['sharing']])) { throw new InvalidParameterException('Possible values for sharing are: ' . implode(', ', array_keys($arrSharing))); } @@ -318,10 +337,16 @@ public function remove($id) return $this->lastResponse->getContent(); } - private function doListing($project, bool $forceUpdate, bool $reverse, array $params) + /** + * @param string|int $projectIdentifier project id or literal identifier + * @param array $params + * + * @return array + */ + private function doListing($projectIdentifier, bool $forceUpdate, bool $reverse, array $params): array { if (true === $forceUpdate || empty($this->versions)) { - $this->versions = $this->listByProject($project, $params); + $this->versions = $this->listByProject($projectIdentifier, $params); } $ret = []; diff --git a/src/Redmine/Api/Wiki.php b/src/Redmine/Api/Wiki.php index b24700a3..224ec81f 100644 --- a/src/Redmine/Api/Wiki.php +++ b/src/Redmine/Api/Wiki.php @@ -21,6 +21,9 @@ */ class Wiki extends AbstractApi { + /** + * @var array + */ private $wikiPages = []; /** @@ -28,12 +31,12 @@ class Wiki extends AbstractApi * * @see http://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Getting-the-pages-list-of-a-wiki * - * @param int|string $projectIdentifier project id or slug - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param int|string $projectIdentifier project id or slug + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * * @throws UnexpectedResponseException if response body could not be converted into array * - * @return array list of wiki pages found for the given project + * @return array list of wiki pages found for the given project */ final public function listByProject($projectIdentifier, array $params = []): array { @@ -59,10 +62,10 @@ final public function listByProject($projectIdentifier, array $params = []): arr * * @see http://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Getting-the-pages-list-of-a-wiki * - * @param int|string $project project name - * @param array $params optional parameters to be passed to the api (offset, limit, ...) + * @param int|string $project project name + * @param array $params optional parameters to be passed to the api (offset, limit, ...) * - * @return array|string|false list of wiki pages found or error message or false + * @return array|string|false list of wiki pages found or error message or false */ public function all($project, array $params = []) { @@ -95,7 +98,7 @@ public function all($project, array $params = []) * @param string $page the page name * @param int $version version of the page * - * @return array|false|string information about the wiki page as array or false|string on error + * @return array|false|string information about the wiki page as array or false|string on error */ public function show($project, $page, $version = null) { @@ -130,9 +133,9 @@ public function show($project, $page, $version = null) /** * Create a new wiki page given an array of $params. * - * @param int|string $project the project name - * @param string $page the page name - * @param array $params the new wiki page data + * @param int|string $project the project name + * @param string $page the page name + * @param array $params the new wiki page data * * @return SimpleXMLElement|string|false */ @@ -163,9 +166,9 @@ public function create($project, $page, array $params = []) /** * Updates wiki page $page. * - * @param int|string $project the project name - * @param string $page the page name - * @param array $params the new wiki page data + * @param int|string $project the project name + * @param string $page the page name + * @param array $params the new wiki page data * * @return string|false */ diff --git a/src/Redmine/Client/ClientApiTrait.php b/src/Redmine/Client/ClientApiTrait.php index e23a314d..3c1ad4a3 100644 --- a/src/Redmine/Client/ClientApiTrait.php +++ b/src/Redmine/Client/ClientApiTrait.php @@ -17,27 +17,30 @@ trait ClientApiTrait */ private array $apiInstances = []; + /** + * @var array + */ private array $apiClassnames = [ - 'attachment' => 'Attachment', - 'group' => 'Group', - 'custom_fields' => 'CustomField', - 'issue' => 'Issue', - 'issue_category' => 'IssueCategory', - 'issue_priority' => 'IssuePriority', - 'issue_relation' => 'IssueRelation', - 'issue_status' => 'IssueStatus', - 'membership' => 'Membership', - 'news' => 'News', - 'project' => 'Project', - 'query' => 'Query', - 'role' => 'Role', - 'time_entry' => 'TimeEntry', - 'time_entry_activity' => 'TimeEntryActivity', - 'tracker' => 'Tracker', - 'user' => 'User', - 'version' => 'Version', - 'wiki' => 'Wiki', - 'search' => 'Search', + 'attachment' => 'Redmine\Api\Attachment', + 'group' => 'Redmine\Api\Group', + 'custom_fields' => 'Redmine\Api\CustomField', + 'issue' => 'Redmine\Api\Issue', + 'issue_category' => 'Redmine\Api\IssueCategory', + 'issue_priority' => 'Redmine\Api\IssuePriority', + 'issue_relation' => 'Redmine\Api\IssueRelation', + 'issue_status' => 'Redmine\Api\IssueStatus', + 'membership' => 'Redmine\Api\Membership', + 'news' => 'Redmine\Api\News', + 'project' => 'Redmine\Api\Project', + 'query' => 'Redmine\Api\Query', + 'role' => 'Redmine\Api\Role', + 'search' => 'Redmine\Api\Search', + 'time_entry' => 'Redmine\Api\TimeEntry', + 'time_entry_activity' => 'Redmine\Api\TimeEntryActivity', + 'tracker' => 'Redmine\Api\Tracker', + 'user' => 'Redmine\Api\User', + 'version' => 'Redmine\Api\Version', + 'wiki' => 'Redmine\Api\Wiki', ]; /** @@ -51,7 +54,7 @@ public function getApi(string $name): Api if (isset($this->apiInstances[$name])) { return $this->apiInstances[$name]; } - $class = 'Redmine\Api\\' . $this->apiClassnames[$name]; + $class = $this->apiClassnames[$name]; $this->apiInstances[$name] = new $class($this); return $this->apiInstances[$name]; From 43446d521999cc1660a5a2ff8b4979658bc7b34c Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 12:58:34 +0200 Subject: [PATCH 6/9] ignore missing parameter and return types in tests --- .phpstan.neon | 14 ++++++++++++++ tests/Unit/Serializer/JsonSerializerTest.php | 4 ++-- tests/Unit/Serializer/XmlSerializerTest.php | 8 -------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.phpstan.neon b/.phpstan.neon index 65eb63b4..bfb533f4 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -9,3 +9,17 @@ parameters: - vendor treatPhpDocTypesAsCertain: false + + ignoreErrors: + - + # Ignore missing or imprecise parameter types for methods in tests + message: '(^Method .+ has parameter .+ with no.* type specified.*\.$)' + path: tests + - + # Ignore imprecise return types for methods in tests + message: '(^Method .+ return type has no.* type specified.+\.$)' + path: tests + - + # Ignore missing return types for methods in tests + message: '(^Method .+ has no return type specified\.$)' + path: tests \ No newline at end of file diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 81f7df7c..58c2ae65 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -63,7 +63,7 @@ public static function getEncodedToNormalizedData(): array * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, string $expected): void { $serializer = JsonSerializer::createFromString($data); @@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void + public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void { $serializer = JsonSerializer::createFromArray($data); diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index 8a96f85b..cc077070 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -122,9 +122,6 @@ public function testCreateFromArrayEncodesToExpectedString(array $data, $expecte $this->assertXmlStringEqualsXmlString($expected, $serializer->__toString()); } - /** - * @return array - */ public static function getNormalizedToEncodedData(): array { return [ @@ -301,8 +298,6 @@ public static function getNormalizedToEncodedData(): array /** * @dataProvider getInvalidSerializedData - * - * @param array $data */ #[DataProvider('getInvalidSerializedData')] public function testCreateFromArrayWithInvalidDataThrowsException(string $message, array $data): void @@ -313,9 +308,6 @@ public function testCreateFromArrayWithInvalidDataThrowsException(string $messag XmlSerializer::createFromArray($data); } - /** - * @return array - */ public static function getInvalidSerializedData(): array { return [ From 912a0550e7ce30c0be83cbe4a9cdfa79504d3092 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 13:12:55 +0200 Subject: [PATCH 7/9] Fix PHPStan level 6 errors in tests --- tests/Behat/Bootstrap/FeatureContext.php | 3 +++ tests/Fixtures/AssertingHttpClient.php | 8 ++++++-- tests/Fixtures/MockClient.php | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/Behat/Bootstrap/FeatureContext.php b/tests/Behat/Bootstrap/FeatureContext.php index 0c2d71d2..2dd5d193 100644 --- a/tests/Behat/Bootstrap/FeatureContext.php +++ b/tests/Behat/Bootstrap/FeatureContext.php @@ -76,6 +76,9 @@ public static function clean(AfterSuiteScope $scope) private mixed $lastReturn; + /** + * @var array + */ private array $lastReturnAsArray; public function __construct(string $redmineVersion) diff --git a/tests/Fixtures/AssertingHttpClient.php b/tests/Fixtures/AssertingHttpClient.php index 90cf7d3e..cbafd365 100644 --- a/tests/Fixtures/AssertingHttpClient.php +++ b/tests/Fixtures/AssertingHttpClient.php @@ -35,8 +35,12 @@ public static function create(TestCase $testCase, array $dataSet, ...$dataSets): return $client; } - private $testCase; - private $client; + private TestCase $testCase; + private HttpClient $client; + + /** + * @var array + */ private $fifoStack = []; private function __construct(TestCase $testCase, HttpClient $client) diff --git a/tests/Fixtures/MockClient.php b/tests/Fixtures/MockClient.php index c7fee46e..735e47d7 100644 --- a/tests/Fixtures/MockClient.php +++ b/tests/Fixtures/MockClient.php @@ -16,7 +16,7 @@ final class MockClient implements Client { use ClientApiTrait; - public static function create() + public static function create(): self { return new self(); } @@ -35,9 +35,9 @@ public static function create() */ public $useOriginalGetMethod = false; - public $responseBodyMock; - public $responseCodeMock; - public $responseContentTypeMock; + public string $responseBodyMock; + public int $responseCodeMock; + public string $responseContentTypeMock; private function __construct() {} From c98fa15aab0ad334ffcbd0c2a53878dfc7a4a43c Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 13:29:54 +0200 Subject: [PATCH 8/9] Fix tests --- src/Redmine/Serializer/XmlSerializer.php | 4 ++-- tests/Integration/Psr18ClientRequestGenerationTest.php | 2 +- tests/Unit/Client/NativeCurlClientTest.php | 2 +- tests/Unit/Client/Psr18ClientTest.php | 2 +- tests/Unit/Serializer/JsonSerializerTest.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Redmine/Serializer/XmlSerializer.php b/src/Redmine/Serializer/XmlSerializer.php index f0b10050..5d686136 100644 --- a/src/Redmine/Serializer/XmlSerializer.php +++ b/src/Redmine/Serializer/XmlSerializer.php @@ -144,9 +144,9 @@ private function denormalize(array $normalized): void } /** - * @param array $params + * @param string|array $params */ - private function createXmlElement(string $rootElementName, array $params): SimpleXMLElement + private function createXmlElement(string $rootElementName, $params): SimpleXMLElement { $value = ''; if (! is_array($params)) { diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index c98edbe6..1d98fe5a 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -69,7 +69,7 @@ public function testPsr18ClientCreatesCorrectRequests( return new Request($method, $uri); }); - $streamFactory = new class () implements StreamFactoryInterface { + $streamFactory = new class implements StreamFactoryInterface { public function createStream(string $content = ''): StreamInterface { return Utils::streamFor($content); diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 0cfd6c8b..1f4c234d 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -767,7 +767,7 @@ public function testGetApiShouldThrowException(): void ); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`, `search`'); + $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `search`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`'); $client->getApi('do_not_exist'); } diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index fd1f260c..3f5b6592 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -303,7 +303,7 @@ public function testGetApiShouldThrowException(): void ); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`, `search`'); + $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `search`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`'); $client->getApi('do_not_exist'); } diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 58c2ae65..81f7df7c 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -63,7 +63,7 @@ public static function getEncodedToNormalizedData(): array * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, string $expected): void + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void { $serializer = JsonSerializer::createFromString($data); @@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void { $serializer = JsonSerializer::createFromArray($data); From 7871ae1ccf6364a771cdac68efb5e7bc731a7272 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 13:38:07 +0200 Subject: [PATCH 9/9] add missing line break --- .phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.phpstan.neon b/.phpstan.neon index bfb533f4..b5eae346 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -22,4 +22,4 @@ parameters: - # Ignore missing return types for methods in tests message: '(^Method .+ has no return type specified\.$)' - path: tests \ No newline at end of file + path: tests