Skip to content

Commit 8d9f2c1

Browse files
authored
Updated php-cs-fixer rules and fixes (#73)
* Update phpcs rules * Bulk phpcs fixes
1 parent 7296feb commit 8d9f2c1

13 files changed

+61
-59
lines changed

.php_cs.dist

+8
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ $finder = PhpCsFixer\Finder::create()
66
;
77

88
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@PSR2' => true,
11+
'@Symfony' => true,
12+
'phpdoc_annotation_without_dot' => false,
13+
'phpdoc_no_alias_tag' => false,
14+
'phpdoc_separation' => false,
15+
'yoda_style' => false,
16+
])
917
->setFinder($finder)
1018
;

src/NewTwitchApi/Auth/OauthApi.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getUserAccessToken($code, string $redirectUri, $state = null): R
5050
'redirect_uri' => $redirectUri,
5151
'code' => $code,
5252
'state' => $state,
53-
]
53+
],
5454
]
5555
);
5656
}
@@ -73,7 +73,7 @@ public function refreshToken(string $refeshToken, string $scope = ''): ResponseI
7373
return $this->makeRequest(
7474
new Request('POST', 'token'),
7575
[
76-
RequestOptions::JSON => $requestOptions
76+
RequestOptions::JSON => $requestOptions,
7777
]
7878
);
7979
}
@@ -88,7 +88,7 @@ public function validateAccessToken(string $accessToken): ResponseInterface
8888
'GET',
8989
'validate',
9090
[
91-
'Authorization' => sprintf('OAuth %s', $accessToken)
91+
'Authorization' => sprintf('OAuth %s', $accessToken),
9292
]
9393
)
9494
);
@@ -115,7 +115,7 @@ public function getAppAccessToken(string $scope = ''): ResponseInterface
115115
'client_secret' => $this->clientSecret,
116116
'grant_type' => 'client_credentials',
117117
'scope' => $scope,
118-
]
118+
],
119119
]
120120
);
121121
}

src/NewTwitchApi/Resources/AdsApi.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class AdsApi extends AbstractResource
1111
{
12-
1312
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference#start-commercial
16-
*/
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference#start-commercial
15+
*/
1716
public function startCommercial(string $bearer, string $broadcasterId, int $length): ResponseInterface
1817
{
1918
$queryParamsMap = [];

src/NewTwitchApi/Resources/BitsApi.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class BitsApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference#get-cheermotes
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference#get-cheermotes
15+
*/
1716
public function getCheermotes(string $bearer, string $broadcasterId = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];
@@ -26,9 +25,9 @@ public function getCheermotes(string $bearer, string $broadcasterId = null): Res
2625
}
2726

2827
/**
29-
* @throws GuzzleException
30-
* @link https://dev.twitch.tv/docs/api/reference#get-bits-leaderboard
31-
*/
28+
* @throws GuzzleException
29+
* @link https://dev.twitch.tv/docs/api/reference#get-bits-leaderboard
30+
*/
3231
public function getBitsLeaderboard(string $bearer, int $count = null, string $period = null, string $startedAt = null, string $userId = null): ResponseInterface
3332
{
3433
$queryParamsMap = [];

src/NewTwitchApi/Resources/ClipsApi.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public function getClips(string $bearer, string $broadcasterId = null, string $g
6969
}
7070

7171
/**
72-
* @throws GuzzleException
73-
* @link https://dev.twitch.tv/docs/api/reference#create-clip
74-
*/
75-
public function createClip(string $bearer, string $broadcasterId, boolean $hasDelay = null): ResponseInterface
72+
* @throws GuzzleException
73+
* @link https://dev.twitch.tv/docs/api/reference#create-clip
74+
*/
75+
public function createClip(string $bearer, string $broadcasterId, bool $hasDelay = null): ResponseInterface
7676
{
7777
$queryParamsMap = [];
7878

src/NewTwitchApi/Resources/EntitlementsApi.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ class EntitlementsApi extends AbstractResource
1212
/**
1313
* @throws GuzzleException
1414
*/
15-
public function getEntitlementGrantsUploadURL(string $bearer, string $manifestId, string $type = "bulk_drops_grant"): ResponseInterface
15+
public function getEntitlementGrantsUploadURL(string $bearer, string $manifestId, string $type = 'bulk_drops_grant'): ResponseInterface
1616
{
1717
$queryParamsMap = [];
1818
$queryParamsMap[] = ['key' => 'manifest_id', 'value' => $manifestId];
1919
$queryParamsMap[] = ['key' => 'type', 'value' => $type];
20+
2021
return $this->postApi('entitlements/upload', $bearer, $queryParamsMap);
2122
}
2223
}

src/NewTwitchApi/Resources/HypeTrainApi.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class HypeTrainApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference#get-hype-train-events
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference#get-hype-train-events
15+
*/
1716
public function getHypeTrainEvents(string $bearer, string $broadcasterId, int $first = null, string $id = null, string $cursor = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];

src/NewTwitchApi/Resources/ModerationApi.php

+10-11
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class ModerationApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference/#get-banned-events
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference/#get-banned-events
15+
*/
1716
public function getBannedEvents(string $bearer, string $broadcasterId, array $ids = [], string $first = null, string $after = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];
@@ -61,9 +60,9 @@ public function getBannedUsers(string $bearer, string $broadcasterId, array $ids
6160
}
6261

6362
/**
64-
* @throws GuzzleException
65-
* @link https://dev.twitch.tv/docs/api/reference/#get-moderators
66-
*/
63+
* @throws GuzzleException
64+
* @link https://dev.twitch.tv/docs/api/reference/#get-moderators
65+
*/
6766
public function getModerators(string $bearer, string $broadcasterId, array $ids = [], string $after = null): ResponseInterface
6867
{
6968
$queryParamsMap = [];
@@ -82,9 +81,9 @@ public function getModerators(string $bearer, string $broadcasterId, array $ids
8281
}
8382

8483
/**
85-
* @throws GuzzleException
86-
* @link https://dev.twitch.tv/docs/api/reference/#get-moderator-events
87-
*/
84+
* @throws GuzzleException
85+
* @link https://dev.twitch.tv/docs/api/reference/#get-moderator-events
86+
*/
8887
public function getModeratorEvents(string $bearer, string $broadcasterId, array $ids = [], string $after = null): ResponseInterface
8988
{
9089
$queryParamsMap = [];

src/NewTwitchApi/Resources/SearchApi.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class SearchApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference#search-categories
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference#search-categories
15+
*/
1716
public function searchCategories(string $bearer, string $query, string $first = null, string $after = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];
@@ -32,9 +31,9 @@ public function searchCategories(string $bearer, string $query, string $first =
3231
}
3332

3433
/**
35-
* @throws GuzzleException
36-
* @link https://dev.twitch.tv/docs/api/reference#search-channels
37-
*/
34+
* @throws GuzzleException
35+
* @link https://dev.twitch.tv/docs/api/reference#search-channels
36+
*/
3837
public function searchChannels(string $bearer, string $query, $liveOnly = null, string $first = null, string $after = null): ResponseInterface
3938
{
4039
$queryParamsMap = [];

src/NewTwitchApi/Resources/StreamsApi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getStreamForUsername(string $bearer, string $username): Response
3232
public function getStreamKey(string $bearer, string $broadcasterId): ResponseInterface
3333
{
3434
$queryParamsMap = [];
35-
35+
3636
$queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId];
3737

3838
return $this->callApi('streams/key', $bearer, $queryParamsMap);

src/NewTwitchApi/Resources/SubscriptionsApi.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class SubscriptionsApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference/#get-broadcaster-subscriptions
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference/#get-broadcaster-subscriptions
15+
*/
1716
public function getBroadcasterSubscriptions(string $bearer, string $broadcasterId, int $first = null, string $after = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];
@@ -30,11 +29,11 @@ public function getBroadcasterSubscriptions(string $bearer, string $broadcasterI
3029

3130
return $this->callApi('subscriptions', $bearer, $queryParamsMap);
3231
}
32+
3333
/**
3434
* @throws GuzzleException
3535
* @link https://dev.twitch.tv/docs/api/reference/#get-broadcaster-s-subscribers
3636
*/
37-
3837
public function getBroadcasterSubscribers(string $bearer, string $broadcasterId, array $ids = []): ResponseInterface
3938
{
4039
$queryParamsMap = [];
@@ -52,7 +51,6 @@ public function getBroadcasterSubscribers(string $bearer, string $broadcasterId,
5251
* @throws GuzzleException
5352
* @link https://dev.twitch.tv/docs/api/reference/#get-subscription-events
5453
*/
55-
5654
public function getSubscriptionEvents(string $bearer, string $broadcasterId, string $eventId = null, string $userId = null, int $first = null, string $after = null): ResponseInterface
5755
{
5856
$queryParamsMap = [];

src/NewTwitchApi/Resources/VideosApi.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
class VideosApi extends AbstractResource
1111
{
12-
13-
/**
14-
* @throws GuzzleException
15-
* @link https://dev.twitch.tv/docs/api/reference/#get-videos
16-
*/
12+
/**
13+
* @throws GuzzleException
14+
* @link https://dev.twitch.tv/docs/api/reference/#get-videos
15+
*/
1716
public function getVideos(string $bearer, array $ids = [], string $userId = null, string $gameId = null, string $first = null, string $before = null, string $after = null, string $language = null, string $period = null, string $sort = null, string $type = null): ResponseInterface
1817
{
1918
$queryParamsMap = [];

test/NewTwitchApi/Resources/UsersTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ private function getGuzzleClientWithMockUserResponse(): Client
5454
JSON;
5555

5656
$db_response = new Response(200, [], $getUserReponseJson);
57-
$mock = new MockHandler([ $db_response, $db_response ]);
57+
$mock = new MockHandler([$db_response, $db_response]);
5858
$handler = HandlerStack::create($mock);
59+
5960
return new Client(['handler' => $handler]);
6061
}
6162
}

0 commit comments

Comments
 (0)