Skip to content

Commit af042f3

Browse files
Applied fixes from reactor
1 parent 6c0116b commit af042f3

File tree

15 files changed

+71
-53
lines changed

15 files changed

+71
-53
lines changed

lib/Gitlab/Api/Groups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ private function getGroupSearchResolver()
422422
$resolver->setDefined('skip_groups')
423423
->setAllowedTypes('skip_groups', 'array')
424424
->setAllowedValues('skip_groups', function (array $value) {
425-
return count($value) == count(array_filter($value, 'is_int'));
425+
return count($value) === count(array_filter($value, 'is_int'));
426426
})
427427
;
428428
$resolver->setDefined('all_available')

lib/Gitlab/Api/GroupsMilestones.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function all($group_id, array $parameters = [])
2525
$resolver->setDefined('iids')
2626
->setAllowedTypes('iids', 'array')
2727
->setAllowedValues('iids', function (array $value) {
28-
return count($value) == count(array_filter($value, 'is_int'));
28+
return count($value) === count(array_filter($value, 'is_int'));
2929
})
3030
;
3131
$resolver->setDefined('state')

lib/Gitlab/Api/Issues.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ protected function createOptionsResolver()
515515
$resolver->setDefined('iids')
516516
->setAllowedTypes('iids', 'array')
517517
->setAllowedValues('iids', function (array $value) {
518-
return count($value) == count(array_filter($value, 'is_int'));
518+
return count($value) === count(array_filter($value, 'is_int'));
519519
})
520520
;
521521
$resolver->setDefined('scope')

lib/Gitlab/Api/MergeRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function all($project_id = null, array $parameters = [])
4848
$resolver->setDefined('iids')
4949
->setAllowedTypes('iids', 'array')
5050
->setAllowedValues('iids', function (array $value) {
51-
return count($value) == count(array_filter($value, 'is_int'));
51+
return count($value) === count(array_filter($value, 'is_int'));
5252
})
5353
;
5454
$resolver->setDefined('state')

lib/Gitlab/Api/Milestones.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function all($project_id, array $parameters = [])
2525
$resolver->setDefined('iids')
2626
->setAllowedTypes('iids', 'array')
2727
->setAllowedValues('iids', function (array $value) {
28-
return count($value) == count(array_filter($value, 'is_int'));
28+
return count($value) === count(array_filter($value, 'is_int'));
2929
})
3030
;
3131
$resolver->setDefined('state')

lib/Gitlab/Api/Projects.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function show($project_id, array $parameters = [])
103103
{
104104
$resolver = $this->createOptionsResolver();
105105
$booleanNormalizer = function (Options $resolver, $value) {
106-
return $value ? true : false;
106+
return (bool) $value;
107107
};
108108
$resolver->setDefined('statistics')
109109
->setAllowedTypes('statistics', 'bool')

lib/Gitlab/Client.php

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
namespace Gitlab;
44

5+
use Gitlab\Api\DeployKeys;
6+
use Gitlab\Api\Deployments;
7+
use Gitlab\Api\Environments;
8+
use Gitlab\Api\Groups;
9+
use Gitlab\Api\GroupsBoards;
10+
use Gitlab\Api\GroupsMilestones;
11+
use Gitlab\Api\IssueBoards;
12+
use Gitlab\Api\IssueLinks;
13+
use Gitlab\Api\Issues;
14+
use Gitlab\Api\IssuesStatistics;
15+
use Gitlab\Api\Jobs;
16+
use Gitlab\Api\Keys;
17+
use Gitlab\Api\MergeRequests;
18+
use Gitlab\Api\Milestones;
19+
use Gitlab\Api\ProjectNamespaces;
20+
use Gitlab\Api\Projects;
21+
use Gitlab\Api\Repositories;
22+
use Gitlab\Api\RepositoryFiles;
23+
use Gitlab\Api\Schedules;
24+
use Gitlab\Api\Snippets;
25+
use Gitlab\Api\SystemHooks;
26+
use Gitlab\Api\Users;
27+
use Gitlab\Api\Tags;
28+
use Gitlab\Api\Version;
29+
use Gitlab\Api\Wiki;
530
use Gitlab\Api\AbstractApi;
631
use Gitlab\Exception\InvalidArgumentException;
732
use Gitlab\HttpClient\Builder;
@@ -155,199 +180,199 @@ public static function createWithHttpClient(HttpClient $httpClient)
155180
*/
156181
public function deployKeys()
157182
{
158-
return new Api\DeployKeys($this);
183+
return new DeployKeys($this);
159184
}
160185

161186
/**
162187
* @return Api\Deployments
163188
*/
164189
public function deployments()
165190
{
166-
return new Api\Deployments($this);
191+
return new Deployments($this);
167192
}
168193

169194
/**
170195
* @return Api\Environments
171196
*/
172197
public function environments()
173198
{
174-
return new Api\Environments($this);
199+
return new Environments($this);
175200
}
176201

177202
/**
178203
* @return Api\Groups
179204
*/
180205
public function groups()
181206
{
182-
return new Api\Groups($this);
207+
return new Groups($this);
183208
}
184209

185210
/**
186211
* @return Api\GroupsBoards
187212
*/
188213
public function groupsBoards()
189214
{
190-
return new Api\GroupsBoards($this);
215+
return new GroupsBoards($this);
191216
}
192217

193218
/**
194219
* @return Api\GroupsMilestones
195220
*/
196221
public function groupsMilestones()
197222
{
198-
return new Api\GroupsMilestones($this);
223+
return new GroupsMilestones($this);
199224
}
200225

201226
/**
202227
* @return Api\IssueBoards
203228
*/
204229
public function issueBoards()
205230
{
206-
return new Api\IssueBoards($this);
231+
return new IssueBoards($this);
207232
}
208233

209234
/**
210235
* @return Api\IssueLinks
211236
*/
212237
public function issueLinks()
213238
{
214-
return new Api\IssueLinks($this);
239+
return new IssueLinks($this);
215240
}
216241

217242
/**
218243
* @return Api\Issues
219244
*/
220245
public function issues()
221246
{
222-
return new Api\Issues($this);
247+
return new Issues($this);
223248
}
224249

225250
/**
226251
* @return Api\IssuesStatistics
227252
*/
228253
public function issuesStatistics()
229254
{
230-
return new Api\IssuesStatistics($this);
255+
return new IssuesStatistics($this);
231256
}
232257

233258
/**
234259
* @return Api\Jobs
235260
*/
236261
public function jobs()
237262
{
238-
return new Api\Jobs($this);
263+
return new Jobs($this);
239264
}
240265

241266
/**
242267
* @return Api\Keys
243268
*/
244269
public function keys()
245270
{
246-
return new Api\Keys($this);
271+
return new Keys($this);
247272
}
248273

249274
/**
250275
* @return Api\MergeRequests
251276
*/
252277
public function mergeRequests()
253278
{
254-
return new Api\MergeRequests($this);
279+
return new MergeRequests($this);
255280
}
256281

257282
/**
258283
* @return Api\Milestones
259284
*/
260285
public function milestones()
261286
{
262-
return new Api\Milestones($this);
287+
return new Milestones($this);
263288
}
264289

265290
/**
266291
* @return Api\ProjectNamespaces
267292
*/
268293
public function namespaces()
269294
{
270-
return new Api\ProjectNamespaces($this);
295+
return new ProjectNamespaces($this);
271296
}
272297

273298
/**
274299
* @return Api\Projects
275300
*/
276301
public function projects()
277302
{
278-
return new Api\Projects($this);
303+
return new Projects($this);
279304
}
280305

281306
/**
282307
* @return Api\Repositories
283308
*/
284309
public function repositories()
285310
{
286-
return new Api\Repositories($this);
311+
return new Repositories($this);
287312
}
288313

289314
/**
290315
* @return Api\RepositoryFiles
291316
*/
292317
public function repositoryFiles()
293318
{
294-
return new Api\RepositoryFiles($this);
319+
return new RepositoryFiles($this);
295320
}
296321

297322
/**
298323
* @return Api\Schedules
299324
*/
300325
public function schedules()
301326
{
302-
return new Api\Schedules($this);
327+
return new Schedules($this);
303328
}
304329

305330
/**
306331
* @return Api\Snippets
307332
*/
308333
public function snippets()
309334
{
310-
return new Api\Snippets($this);
335+
return new Snippets($this);
311336
}
312337

313338
/**
314339
* @return Api\SystemHooks
315340
*/
316341
public function systemHooks()
317342
{
318-
return new Api\SystemHooks($this);
343+
return new SystemHooks($this);
319344
}
320345

321346
/**
322347
* @return Api\Users
323348
*/
324349
public function users()
325350
{
326-
return new Api\Users($this);
351+
return new Users($this);
327352
}
328353

329354
/**
330355
* @return Api\Tags
331356
*/
332357
public function tags()
333358
{
334-
return new Api\Tags($this);
359+
return new Tags($this);
335360
}
336361

337362
/**
338363
* @return Api\Version
339364
*/
340365
public function version()
341366
{
342-
return new Api\Version($this);
367+
return new Version($this);
343368
}
344369

345370
/**
346371
* @return Api\Wiki
347372
*/
348373
public function wiki()
349374
{
350-
return new Api\Wiki($this);
375+
return new Wiki($this);
351376
}
352377

353378
/**

lib/Gitlab/HttpClient/Plugin/ApiVersion.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Gitlab\HttpClient\Plugin;
44

5+
use Http\Client\Common\Plugin\VersionBridgePlugin;
56
use Http\Client\Common\Plugin;
67
use Http\Promise\Promise;
78
use Psr\Http\Message\RequestInterface;
@@ -18,7 +19,7 @@
1819
*/
1920
class ApiVersion implements Plugin
2021
{
21-
use Plugin\VersionBridgePlugin;
22+
use VersionBridgePlugin;
2223

2324
/**
2425
* @var bool

lib/Gitlab/HttpClient/Plugin/Authentication.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Gitlab\HttpClient\Plugin;
44

5+
use Http\Client\Common\Plugin\VersionBridgePlugin;
56
use Gitlab\Client;
67
use Http\Client\Common\Plugin;
78
use Http\Promise\Promise;
@@ -19,7 +20,7 @@
1920
*/
2021
class Authentication implements Plugin
2122
{
22-
use Plugin\VersionBridgePlugin;
23+
use VersionBridgePlugin;
2324

2425
/**
2526
* @var string

lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Gitlab\HttpClient\Plugin;
44

5+
use Http\Client\Common\Plugin\VersionBridgePlugin;
56
use Gitlab\Exception\ApiLimitExceededException;
67
use Gitlab\Exception\ErrorException;
78
use Gitlab\Exception\RuntimeException;
@@ -24,7 +25,7 @@
2425
*/
2526
class GitlabExceptionThrower implements Plugin
2627
{
27-
use Plugin\VersionBridgePlugin;
28+
use VersionBridgePlugin;
2829

2930
/**
3031
* Handle the request and return the response coming from the next callable.

lib/Gitlab/ResultPager.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,7 @@ protected function postFetch()
167167
{
168168
$response = $this->client->getLastResponse();
169169

170-
if (null === $response) {
171-
$this->pagination = [];
172-
} else {
173-
$this->pagination = ResponseMediator::getPagination($response);
174-
}
170+
$this->pagination = null === $response ? [] : ResponseMediator::getPagination($response);
175171
}
176172

177173
/**

test/Gitlab/Tests/Api/AbstractApiTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,12 @@ protected function getAbstractApiMock(array $methods = [])
4848
;
4949
$client = Client::createWithHttpClient($httpClient);
5050

51-
$abstractApiMock = $this->getMockBuilder('Gitlab\Api\AbstractApi')
51+
return $this->getMockBuilder('Gitlab\Api\AbstractApi')
5252
->setConstructorArgs([
5353
$client,
5454
null,
5555
])
5656
->setMethods($methods)
57-
->getMockForAbstractClass()
58-
;
59-
60-
return $abstractApiMock;
57+
->getMockForAbstractClass();
6158
}
6259
}

0 commit comments

Comments
 (0)