Skip to content

Commit b4e4ed7

Browse files
Add more return types
1 parent a3f2557 commit b4e4ed7

29 files changed

+45
-42
lines changed

tests/Api/DeployKeysTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function shouldGetAllDeployKeys(): void
3434
$this->assertEquals($expectedArray, $api->all(['page' => 2, 'per_page' => 5]));
3535
}
3636

37-
protected function getMultipleDeployKeysData()
37+
protected function getMultipleDeployKeysData(): array
3838
{
3939
return [
4040
[
@@ -52,7 +52,7 @@ protected function getMultipleDeployKeysData()
5252
];
5353
}
5454

55-
protected function getApiClass()
55+
protected function getApiClass(): string
5656
{
5757
return DeployKeys::class;
5858
}

tests/Api/DeploymentsTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use Gitlab\Api\Deployments;
1818
use PHPUnit\Framework\Attributes\Test;
19+
use PHPUnit\Framework\MockObject\MockObject;
1920

2021
class DeploymentsTest extends TestCase
2122
{
@@ -107,7 +108,7 @@ public function shouldShowDeployment(): void
107108
$this->assertEquals($expectedArray, $api->show(1, 42));
108109
}
109110

110-
private function getMultipleDeploymentsData()
111+
private function getMultipleDeploymentsData(): array
111112
{
112113
return [
113114
[
@@ -241,7 +242,7 @@ private function getMultipleDeploymentsData()
241242
];
242243
}
243244

244-
protected function getMultipleDeploymentsRequestMock(string $path, array $expectedArray, array $expectedParameters)
245+
protected function getMultipleDeploymentsRequestMock(string $path, array $expectedArray, array $expectedParameters): MockObject
245246
{
246247
$api = $this->getApiMock();
247248
$api->expects($this->once())
@@ -269,7 +270,7 @@ public function shouldGetAllDeploymentsSortedByCreatedAt(): void
269270
);
270271
}
271272

272-
protected function getApiClass()
273+
protected function getApiClass(): string
273274
{
274275
return Deployments::class;
275276
}

tests/Api/EnvironmentsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function shouldStopEnvironment(): void
195195
$this->assertEquals($expectedBool, $api->stop(1, 3));
196196
}
197197

198-
protected function getApiClass()
198+
protected function getApiClass(): string
199199
{
200200
return Environments::class;
201201
}

tests/Api/EventsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class EventsTest extends TestCase
2020
{
21-
protected function getApiClass()
21+
protected function getApiClass(): string
2222
{
2323
return Events::class;
2424
}

tests/Api/GroupBoardsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function shouldDeleteList(): void
218218
$this->assertEquals($expectedBool, $api->deleteList(1, 2, 3));
219219
}
220220

221-
protected function getApiClass()
221+
protected function getApiClass(): string
222222
{
223223
return GroupsBoards::class;
224224
}

tests/Api/GroupsEpicsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function shouldGetEpicsIssues(): void
114114
$this->assertEquals($expectedArray, $api->issues(1, 2));
115115
}
116116

117-
protected function getApiClass()
117+
protected function getApiClass(): string
118118
{
119119
return GroupsEpics::class;
120120
}

tests/Api/GroupsMilestonesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function shouldGetAllMilestonesWithParameterTwoIidsValues(): void
6262
$api->all(1, ['iids' => [456, 789]]);
6363
}
6464

65-
public static function getAllMilestonesWithParameterStateDataProvider()
65+
public static function getAllMilestonesWithParameterStateDataProvider(): array
6666
{
6767
return [
6868
GroupsMilestones::STATE_ACTIVE => [GroupsMilestones::STATE_ACTIVE],
@@ -220,7 +220,7 @@ public function shouldGetMilestonesMergeRequests(): void
220220
$this->assertEquals($expectedArray, $api->mergeRequests(1, 3));
221221
}
222222

223-
protected function getApiClass()
223+
protected function getApiClass(): string
224224
{
225225
return GroupsMilestones::class;
226226
}

tests/Api/GroupsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public function shouldRemoveVariable(): void
534534
$this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password'));
535535
}
536536

537-
protected function getApiClass()
537+
protected function getApiClass(): string
538538
{
539539
return Groups::class;
540540
}

tests/Api/IssueBoardsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function shouldDeleteList(): void
218218
$this->assertEquals($expectedBool, $api->deleteList(1, 2, 3));
219219
}
220220

221-
protected function getApiClass()
221+
protected function getApiClass(): string
222222
{
223223
return IssueBoards::class;
224224
}

tests/Api/IssueLinksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IssueLinksTest extends TestCase
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
protected function getApiClass()
25+
protected function getApiClass(): string
2626
{
2727
return IssueLinks::class;
2828
}

tests/Api/IssueSubscribeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testUnsubscribeIssue(): void
4545
$this->assertEquals($expectedValue, $api->unsubscribe(1, 2));
4646
}
4747

48-
protected function getApiClass()
48+
protected function getApiClass(): string
4949
{
5050
return Issues::class;
5151
}

tests/Api/IssuesStatisticsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function shouldGetGroup(): void
9393
$this->assertEquals($expectedArray, $api->group(1, []));
9494
}
9595

96-
protected function getApiClass()
96+
protected function getApiClass(): string
9797
{
9898
return IssuesStatistics::class;
9999
}

tests/Api/IssuesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ public function shouldGetIssueResourceLabelEvent(): void
595595
$this->assertEquals($expectedArray, $api->showResourceLabelEvent(1, 2, 3));
596596
}
597597

598-
protected function getApiClass()
598+
protected function getApiClass(): string
599599
{
600600
return Issues::class;
601601
}

tests/Api/JobsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function shouldPlay(): void
265265
$this->assertEquals($expectedArray, $api->play(1, 3));
266266
}
267267

268-
protected function getApiClass()
268+
protected function getApiClass(): string
269269
{
270270
return Jobs::class;
271271
}

tests/Api/KeysTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function shouldShowKey(): void
3232
$this->assertEquals($expectedArray, $api->show(1));
3333
}
3434

35-
protected function getApiClass()
35+
protected function getApiClass(): string
3636
{
3737
return Keys::class;
3838
}

tests/Api/MergeRequestsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,15 +793,15 @@ public function shoudDeleteLevelRule(): void
793793
$this->assertEquals($expectedValue, $api->deleteLevelRule(1, 2, 3));
794794
}
795795

796-
protected function getMultipleMergeRequestsData()
796+
protected function getMultipleMergeRequestsData(): array
797797
{
798798
return [
799799
['id' => 1, 'title' => 'A merge request'],
800800
['id' => 2, 'title' => 'Another merge request'],
801801
];
802802
}
803803

804-
protected function getApiClass()
804+
protected function getApiClass(): string
805805
{
806806
return MergeRequests::class;
807807
}

tests/Api/MilestonesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function shouldGetMilestonesMergeRequests(): void
132132
$this->assertEquals($expectedArray, $api->mergeRequests(1, 3));
133133
}
134134

135-
protected function getApiClass()
135+
protected function getApiClass(): string
136136
{
137137
return Milestones::class;
138138
}

tests/Api/PackagesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function shouldRemovePackageFile(): void
109109
$this->assertEquals($expectedBool, $api->removeFile(1, 1, 25));
110110
}
111111

112-
protected function getApiClass()
112+
protected function getApiClass(): string
113113
{
114114
return Packages::class;
115115
}

tests/Api/ProjectNamespacesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function shouldShowNamespace(): void
5252
$this->assertEquals($expectedArray, $api->show(1));
5353
}
5454

55-
protected function getApiClass()
55+
protected function getApiClass(): string
5656
{
5757
return ProjectNamespaces::class;
5858
}

tests/Api/ProjectsTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Gitlab\Api\Projects;
1919
use PHPUnit\Framework\Attributes\DataProvider;
2020
use PHPUnit\Framework\Attributes\Test;
21+
use PHPUnit\Framework\MockObject\MockObject;
2122

2223
class ProjectsTest extends TestCase
2324
{
@@ -2135,7 +2136,7 @@ public function shouldRemoveVariable(): void
21352136
$this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password'));
21362137
}
21372138

2138-
protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $expectedParameters = [])
2139+
protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject
21392140
{
21402141
$api = $this->getApiMock();
21412142
$api->expects($this->once())
@@ -2237,15 +2238,15 @@ public function shouldGetDeploymentsFiltered(): void
22372238
$this->assertEquals($expectedArray, $api->deployments(1, ['updated_after' => $time]));
22382239
}
22392240

2240-
protected function getMultipleProjectsData()
2241+
protected function getMultipleProjectsData(): array
22412242
{
22422243
return [
22432244
['id' => 1, 'name' => 'A project'],
22442245
['id' => 2, 'name' => 'Another project'],
22452246
];
22462247
}
22472248

2248-
protected function getMultipleProjectsDataWithNamespace()
2249+
protected function getMultipleProjectsDataWithNamespace(): array
22492250
{
22502251
return [
22512252
['id' => 1, 'name' => 'A project', 'namespace' => ['id' => 4, 'name' => 'A namespace', 'path' => 'a_namespace']],
@@ -2264,7 +2265,7 @@ public static function possibleAccessLevels(): array
22642265
];
22652266
}
22662267

2267-
public function getBadgeExpectedArray()
2268+
public function getBadgeExpectedArray(): array
22682269
{
22692270
return [
22702271
[
@@ -2730,7 +2731,7 @@ public function shouldRemoveProtectedTag(): void
27302731
$this->assertEquals($expectedBool, $api->deleteProtectedTag(1, 'release-*'));
27312732
}
27322733

2733-
protected function getApiClass()
2734+
protected function getApiClass(): string
27342735
{
27352736
return Projects::class;
27362737
}

tests/Api/RepositoriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ public function shouldCherryPick(): void
652652
$this->assertEquals($expectedArray, $api->cherryPick(1, '123456123456', ['branch' => 'feature_branch']));
653653
}
654654

655-
protected function getApiClass()
655+
protected function getApiClass(): string
656656
{
657657
return Repositories::class;
658658
}

tests/Api/ScheduleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function shouldPlay(): void
213213
$this->assertEquals($expectedBool, $api->play(1, 2));
214214
}
215215

216-
protected function getApiClass()
216+
protected function getApiClass(): string
217217
{
218218
return Schedules::class;
219219
}

tests/Api/SearchTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function shouldGetAll(): void
4949
]));
5050
}
5151

52-
protected function getApiClass()
52+
protected function getApiClass(): string
5353
{
5454
return Search::class;
5555
}

tests/Api/SnippetsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function shouldRevokeSnippetAwardEmoji(): void
219219
$this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3));
220220
}
221221

222-
protected function getApiClass()
222+
protected function getApiClass(): string
223223
{
224224
return Snippets::class;
225225
}

tests/Api/SystemHooksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function shouldRemoveHook(): void
8080
$this->assertEquals($expectedBool, $api->remove(3));
8181
}
8282

83-
protected function getApiClass()
83+
protected function getApiClass(): string
8484
{
8585
return SystemHooks::class;
8686
}

tests/Api/TagsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public static function releaseDataProvider(): array
144144
];
145145
}
146146

147-
protected function getApiClass()
147+
protected function getApiClass(): string
148148
{
149149
return Tags::class;
150150
}

tests/Api/UsersTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Gitlab\Api\Users;
1818
use PHPUnit\Framework\Attributes\DataProvider;
1919
use PHPUnit\Framework\Attributes\Test;
20+
use PHPUnit\Framework\MockObject\MockObject;
2021

2122
class UsersTest extends TestCase
2223
{
@@ -100,7 +101,7 @@ public function shouldShowUser(): void
100101
$this->assertEquals($expectedArray, $api->show(1));
101102
}
102103

103-
protected function getUsersMembershipsData()
104+
protected function getUsersMembershipsData(): array
104105
{
105106
return [
106107
[
@@ -118,7 +119,7 @@ protected function getUsersMembershipsData()
118119
];
119120
}
120121

121-
protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $expectedParameters = [])
122+
protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject
122123
{
123124
$api = $this->getApiMock();
124125
$api->expects($this->once())
@@ -160,15 +161,15 @@ public function shouldShowUsersMembershipsWithTypeNamespace(): void
160161
$this->assertEquals($expectedArray, $api->usersMemberships(1, ['type' => 'Namespace']));
161162
}
162163

163-
protected function getUsersProjectsData()
164+
protected function getUsersProjectsData(): array
164165
{
165166
return [
166167
['id' => 1, 'name' => 'matt-project-1'],
167168
['id' => 2, 'name' => 'matt-project-2'],
168169
];
169170
}
170171

171-
protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expectedParameters = [])
172+
protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject
172173
{
173174
$api = $this->getApiMock();
174175
$api->expects($this->once())
@@ -799,7 +800,7 @@ public function shouldGetCurrentUserInactiveImpersonationTokens(): void
799800
$this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'inactive']));
800801
}
801802

802-
protected function getApiClass()
803+
protected function getApiClass(): string
803804
{
804805
return Users::class;
805806
}

tests/Api/VersionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function shouldShowVersion(): void
3535
$this->assertEquals($expectedArray, $api->show());
3636
}
3737

38-
protected function getApiClass()
38+
protected function getApiClass(): string
3939
{
4040
return Version::class;
4141
}

0 commit comments

Comments
 (0)