From e19878b757d473145d023894a5bcb16b537ea06b Mon Sep 17 00:00:00 2001 From: Buffele Date: Thu, 9 Jan 2025 05:47:59 -0700 Subject: [PATCH] fix php 8 deprecation warnings --- spec/TwitchApi/Resources/EventSubApiSpec.php | 2 +- src/Auth/OauthApi.php | 6 +++--- src/HelixGuzzleClient.php | 2 +- src/RequestGenerator.php | 2 +- src/Resources/AbstractResource.php | 4 ++-- src/Resources/AnalyticsApi.php | 4 ++-- src/Resources/BitsApi.php | 6 +++--- src/Resources/ChannelPointsApi.php | 6 +++--- src/Resources/ChannelsApi.php | 4 ++-- src/Resources/CharityApi.php | 2 +- src/Resources/ChatApi.php | 6 +++--- src/Resources/ClipsApi.php | 10 +++++----- src/Resources/EntitlementsApi.php | 4 ++-- src/Resources/EventSubApi.php | 16 ++++++++-------- src/Resources/GamesApi.php | 2 +- src/Resources/HypeTrainApi.php | 2 +- src/Resources/ModerationApi.php | 12 ++++++------ src/Resources/PollsApi.php | 2 +- src/Resources/PredictionsApi.php | 4 ++-- src/Resources/ScheduleApi.php | 6 +++--- src/Resources/SearchApi.php | 4 ++-- src/Resources/StreamsApi.php | 12 ++++++------ src/Resources/SubscriptionsApi.php | 2 +- src/Resources/TagsApi.php | 2 +- src/Resources/TeamsApi.php | 2 +- src/Resources/UsersApi.php | 10 +++++----- src/Resources/VideosApi.php | 2 +- src/Resources/WebhooksApi.php | 2 +- src/TwitchApi.php | 2 +- src/Webhooks/WebhooksSubscriptionApi.php | 2 +- 30 files changed, 71 insertions(+), 71 deletions(-) diff --git a/spec/TwitchApi/Resources/EventSubApiSpec.php b/spec/TwitchApi/Resources/EventSubApiSpec.php index 9b13d0f..f26cc8e 100644 --- a/spec/TwitchApi/Resources/EventSubApiSpec.php +++ b/spec/TwitchApi/Resources/EventSubApiSpec.php @@ -14,7 +14,7 @@ class EventSubApiSpec extends ObjectBehavior private string $secret = 'SECRET'; private string $callback = 'https://example.com/'; - private function createEventSubSubscription(string $type, string $version, array $condition, RequestGenerator $requestGenerator, bool $isBatchingEnabled = null) + private function createEventSubSubscription(string $type, string $version, array $condition, RequestGenerator $requestGenerator, ?bool $isBatchingEnabled = null) { $bodyParams = []; diff --git a/src/Auth/OauthApi.php b/src/Auth/OauthApi.php index 7ec02e2..6bbeeac 100644 --- a/src/Auth/OauthApi.php +++ b/src/Auth/OauthApi.php @@ -16,7 +16,7 @@ class OauthApi private $clientSecret; private $guzzleClient; - public function __construct(string $clientId, string $clientSecret, Client $guzzleClient = null) + public function __construct(string $clientId, string $clientSecret, ?Client $guzzleClient = null) { $this->clientId = $clientId; $this->clientSecret = $clientSecret; @@ -26,7 +26,7 @@ public function __construct(string $clientId, string $clientSecret, Client $guzz /** * @return string A full authentication URL, including the Guzzle client's base URI. */ - public function getAuthUrl(string $redirectUri, string $responseType = 'code', string $scope = '', bool $forceVerify = false, string $state = null): string + public function getAuthUrl(string $redirectUri, string $responseType = 'code', string $scope = '', bool $forceVerify = false, ?string $state = null): string { return sprintf( '%s%s', @@ -131,7 +131,7 @@ private function makeRequest(Request $request, array $options = []): ResponseInt /** * @return string A partial authentication URL, excluding the Guzzle client's base URI. */ - private function getPartialAuthUrl(string $redirectUri, string $responseType = 'code', string $scope = '', bool $forceVerify = false, string $state = null): string + private function getPartialAuthUrl(string $redirectUri, string $responseType = 'code', string $scope = '', bool $forceVerify = false, ?string $state = null): string { $optionalParameters = ''; $optionalParameters .= $forceVerify ? '&force_verify=true' : ''; diff --git a/src/HelixGuzzleClient.php b/src/HelixGuzzleClient.php index 5af0bcd..72db768 100644 --- a/src/HelixGuzzleClient.php +++ b/src/HelixGuzzleClient.php @@ -11,7 +11,7 @@ class HelixGuzzleClient private $client; private const BASE_URI = 'https://api.twitch.tv/helix/'; - public function __construct(string $clientId, array $config = [], string $baseUri = null) + public function __construct(string $clientId, array $config = [], ?string $baseUri = null) { if ($baseUri == null) { $baseUri = self::BASE_URI; diff --git a/src/RequestGenerator.php b/src/RequestGenerator.php index 8a52048..4c4d9b0 100644 --- a/src/RequestGenerator.php +++ b/src/RequestGenerator.php @@ -7,7 +7,7 @@ class RequestGenerator { - public function generate(string $httpMethod, string $uriEndpoint, string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): RequestInterface + public function generate(string $httpMethod, string $uriEndpoint, ?string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): RequestInterface { $headers = [ 'Accept' => 'application/json', diff --git a/src/Resources/AbstractResource.php b/src/Resources/AbstractResource.php index 0e1dc59..140f304 100644 --- a/src/Resources/AbstractResource.php +++ b/src/Resources/AbstractResource.php @@ -31,7 +31,7 @@ protected function getApi(string $uriEndpoint, string $bearer, array $queryParam /** * @throws GuzzleException */ - protected function getApiWithOptionalAuth(string $uriEndpoint, string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): ResponseInterface + protected function getApiWithOptionalAuth(string $uriEndpoint, ?string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): ResponseInterface { return $this->sendToApi('GET', $uriEndpoint, $bearer, $queryParamsMap, $bodyParams); } @@ -68,7 +68,7 @@ protected function putApi(string $uriEndpoint, string $bearer, array $queryParam return $this->sendToApi('PUT', $uriEndpoint, $bearer, $queryParamsMap, $bodyParams); } - private function sendToApi(string $httpMethod, string $uriEndpoint, string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): ResponseInterface + private function sendToApi(string $httpMethod, string $uriEndpoint, ?string $bearer = null, array $queryParamsMap = [], array $bodyParams = []): ResponseInterface { return $this->guzzleClient->send($this->requestGenerator->generate($httpMethod, $uriEndpoint, $bearer, $queryParamsMap, $bodyParams)); } diff --git a/src/Resources/AnalyticsApi.php b/src/Resources/AnalyticsApi.php index 90cccaf..022dd01 100644 --- a/src/Resources/AnalyticsApi.php +++ b/src/Resources/AnalyticsApi.php @@ -13,7 +13,7 @@ class AnalyticsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-extension-analytics */ - public function getExtensionAnalytics(string $bearer, string $extensionId = null, string $type = null, int $first = null, string $after = null, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getExtensionAnalytics(string $bearer, ?string $extensionId = null, ?string $type = null, ?int $first = null, ?string $after = null, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { $queryParamsMap = []; @@ -48,7 +48,7 @@ public function getExtensionAnalytics(string $bearer, string $extensionId = null * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-game-analytics */ - public function getGameAnalytics(string $bearer, string $gameId = null, string $type = null, int $first = null, string $after = null, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getGameAnalytics(string $bearer, ?string $gameId = null, ?string $type = null, ?int $first = null, ?string $after = null, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/BitsApi.php b/src/Resources/BitsApi.php index d0b2c50..555d073 100644 --- a/src/Resources/BitsApi.php +++ b/src/Resources/BitsApi.php @@ -13,7 +13,7 @@ class BitsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-cheermotes */ - public function getCheermotes(string $bearer, string $broadcasterId = null): ResponseInterface + public function getCheermotes(string $bearer, ?string $broadcasterId = null): ResponseInterface { $queryParamsMap = []; @@ -28,7 +28,7 @@ public function getCheermotes(string $bearer, string $broadcasterId = null): Res * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-bits-leaderboard */ - public function getBitsLeaderboard(string $bearer, int $count = null, string $period = null, string $startedAt = null, string $userId = null): ResponseInterface + public function getBitsLeaderboard(string $bearer, ?int $count = null, ?string $period = null, ?string $startedAt = null, ?string $userId = null): ResponseInterface { $queryParamsMap = []; @@ -55,7 +55,7 @@ public function getBitsLeaderboard(string $bearer, int $count = null, string $pe * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-extension-transactions */ - public function getExtensionTransactions(string $bearer, string $extensionId, array $transactionIds = [], int $first = null, string $after = null): ResponseInterface + public function getExtensionTransactions(string $bearer, string $extensionId, array $transactionIds = [], ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/ChannelPointsApi.php b/src/Resources/ChannelPointsApi.php index a1fac78..5242877 100644 --- a/src/Resources/ChannelPointsApi.php +++ b/src/Resources/ChannelPointsApi.php @@ -12,7 +12,7 @@ class ChannelPointsApi extends AbstractResource /** * @throws GuzzleException */ - public function getCustomRewardById(string $bearer, string $broadcasterId, string $id, bool $onlyManageableRewards = null): ResponseInterface + public function getCustomRewardById(string $bearer, string $broadcasterId, string $id, ?bool $onlyManageableRewards = null): ResponseInterface { return $this->getCustomReward($bearer, $broadcasterId, [$id], $onlyManageableRewards); } @@ -21,7 +21,7 @@ public function getCustomRewardById(string $bearer, string $broadcasterId, strin * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-custom-reward */ - public function getCustomReward(string $bearer, string $broadcasterId, array $ids = [], bool $onlyManageableRewards = null): ResponseInterface + public function getCustomReward(string $bearer, string $broadcasterId, array $ids = [], ?bool $onlyManageableRewards = null): ResponseInterface { $queryParamsMap = []; @@ -42,7 +42,7 @@ public function getCustomReward(string $bearer, string $broadcasterId, array $id * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-custom-reward-redemption */ - public function getCustomRewardRedemption(string $bearer, string $broadcasterId, string $rewardId = null, array $ids = [], string $status = null, string $sort = null, string $after = null, string $first = null): ResponseInterface + public function getCustomRewardRedemption(string $bearer, string $broadcasterId, ?string $rewardId = null, array $ids = [], ?string $status = null, ?string $sort = null, ?string $after = null, ?string $first = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/ChannelsApi.php b/src/Resources/ChannelsApi.php index 4daa3b8..c352a76 100644 --- a/src/Resources/ChannelsApi.php +++ b/src/Resources/ChannelsApi.php @@ -57,7 +57,7 @@ public function modifyChannelInfo(string $bearer, string $broadcasterId, $bodyPa * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-followed-channels */ - public function getFollowedChannels(string $bearer, string $userId, string $broadcasterId = null, int $first = null, string $after = null): ResponseInterface + public function getFollowedChannels(string $bearer, string $userId, ?string $broadcasterId = null, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -82,7 +82,7 @@ public function getFollowedChannels(string $bearer, string $userId, string $broa * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-channel-followers */ - public function getChannelFollowers(string $bearer, string $broadcasterId, string $userId = null, int $first = null, string $after = null): ResponseInterface + public function getChannelFollowers(string $bearer, string $broadcasterId, ?string $userId = null, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/CharityApi.php b/src/Resources/CharityApi.php index 997db4f..23df548 100644 --- a/src/Resources/CharityApi.php +++ b/src/Resources/CharityApi.php @@ -25,7 +25,7 @@ public function getCharityCampaign(string $bearer, string $broadcasterId): Respo * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-charity-campaign-donations */ - public function getCharityCampaignDonations(string $bearer, string $broadcasterId, int $first = null, string $after = null): ResponseInterface + public function getCharityCampaignDonations(string $bearer, string $broadcasterId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; $queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId]; diff --git a/src/Resources/ChatApi.php b/src/Resources/ChatApi.php index 1786c64..dddfc73 100644 --- a/src/Resources/ChatApi.php +++ b/src/Resources/ChatApi.php @@ -78,7 +78,7 @@ public function getGlobalChatBadges(string $bearer): ResponseInterface * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-chat-settings */ - public function getChatSettings(string $bearer, string $broadcasterId, string $moderatorId = null): ResponseInterface + public function getChatSettings(string $bearer, string $broadcasterId, ?string $moderatorId = null): ResponseInterface { $queryParamsMap = []; $queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId]; @@ -112,7 +112,7 @@ public function updateChatSettings(string $bearer, string $broadcasterId, string * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#send-chat-announcement */ - public function sendChatAnnouncement(string $bearer, string $broadcasterId, string $moderatorId, string $message, string $color = null): ResponseInterface + public function sendChatAnnouncement(string $bearer, string $broadcasterId, string $moderatorId, string $message, ?string $color = null): ResponseInterface { $queryParamsMap = $bodyParamsMap = []; @@ -161,7 +161,7 @@ public function updateUserChatColor(string $bearer, string $userId, string $colo * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-chatters */ - public function getChatters(string $bearer, string $broadcasterId, string $moderatorId, int $first = null, string $after = null): ResponseInterface + public function getChatters(string $bearer, string $broadcasterId, string $moderatorId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/ClipsApi.php b/src/Resources/ClipsApi.php index d0c6d78..97158e5 100644 --- a/src/Resources/ClipsApi.php +++ b/src/Resources/ClipsApi.php @@ -12,7 +12,7 @@ class ClipsApi extends AbstractResource /** * @throws GuzzleException */ - public function getClipsByBroadcasterId(string $bearer, string $broadcasterId, int $first = null, string $before = null, string $after = null, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getClipsByBroadcasterId(string $bearer, string $broadcasterId, ?int $first = null, ?string $before = null, ?string $after = null, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { return $this->getClips($bearer, $broadcasterId, null, null, $first, $before, $after, $startedAt, $endedAt); } @@ -20,7 +20,7 @@ public function getClipsByBroadcasterId(string $bearer, string $broadcasterId, i /** * @throws GuzzleException */ - public function getClipsByGameId(string $bearer, string $gameId, int $first = null, string $before = null, string $after = null, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getClipsByGameId(string $bearer, string $gameId, ?int $first = null, ?string $before = null, ?string $after = null, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { return $this->getClips($bearer, null, $gameId, null, $first, $before, $after, $startedAt, $endedAt); } @@ -28,7 +28,7 @@ public function getClipsByGameId(string $bearer, string $gameId, int $first = nu /** * @throws GuzzleException */ - public function getClipsByIds(string $bearer, string $clipIds, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getClipsByIds(string $bearer, string $clipIds, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { return $this->getClips($bearer, null, null, $clipIds, null, null, null, $startedAt, $endedAt); } @@ -37,7 +37,7 @@ public function getClipsByIds(string $bearer, string $clipIds, string $startedAt * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-clips */ - public function getClips(string $bearer, string $broadcasterId = null, string $gameId = null, string $clipIds = null, int $first = null, string $before = null, string $after = null, string $startedAt = null, string $endedAt = null): ResponseInterface + public function getClips(string $bearer, ?string $broadcasterId = null, ?string $gameId = null, ?string $clipIds = null, ?int $first = null, ?string $before = null, ?string $after = null, ?string $startedAt = null, ?string $endedAt = null): ResponseInterface { $queryParamsMap = []; if ($broadcasterId) { @@ -72,7 +72,7 @@ public function getClips(string $bearer, string $broadcasterId = null, string $g * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#create-clip */ - public function createClip(string $bearer, string $broadcasterId, bool $hasDelay = null): ResponseInterface + public function createClip(string $bearer, string $broadcasterId, ?bool $hasDelay = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/EntitlementsApi.php b/src/Resources/EntitlementsApi.php index 3e27ae9..869d26c 100644 --- a/src/Resources/EntitlementsApi.php +++ b/src/Resources/EntitlementsApi.php @@ -43,7 +43,7 @@ public function getCodeStatus(string $bearer, int $userId, array $codes = []): R * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-drops-entitlements */ - public function getDropsEntitlements(string $bearer, string $id = null, string $userId = null, string $gameId = null, string $after = null, int $first = null, string $fulfillmentStatus = null): ResponseInterface + public function getDropsEntitlements(string $bearer, ?string $id = null, ?string $userId = null, ?string $gameId = null, ?string $after = null, ?int $first = null, ?string $fulfillmentStatus = null): ResponseInterface { $queryParamsMap = []; @@ -78,7 +78,7 @@ public function getDropsEntitlements(string $bearer, string $id = null, string $ * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#update-drops-entitlements */ - public function updateDropsEntitlements(string $bearer, array $entitlement_ids = null, string $fulfillment_status = null): ResponseInterface + public function updateDropsEntitlements(string $bearer, ?array $entitlement_ids = null, ?string $fulfillment_status = null): ResponseInterface { $bodyParamsMap = []; diff --git a/src/Resources/EventSubApi.php b/src/Resources/EventSubApi.php index 1ce3877..7a0d06f 100644 --- a/src/Resources/EventSubApi.php +++ b/src/Resources/EventSubApi.php @@ -13,7 +13,7 @@ class EventSubApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-eventsub-subscriptions */ - public function getEventSubSubscription(string $bearer, string $status = null, string $type = null, string $after = null, string $userId = null): ResponseInterface + public function getEventSubSubscription(string $bearer, ?string $status = null, ?string $type = null, ?string $after = null, ?string $userId = null): ResponseInterface { $queryParamsMap = []; @@ -40,7 +40,7 @@ public function getEventSubSubscription(string $bearer, string $status = null, s * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#create-eventsub-subscription */ - public function createEventSubSubscription(string $bearer, string $secret, string $callback, string $type, string $version, array $condition, bool $isBatchingEnabled = null): ResponseInterface + public function createEventSubSubscription(string $bearer, string $secret, string $callback, string $type, string $version, array $condition, ?bool $isBatchingEnabled = null): ResponseInterface { $bodyParams = []; @@ -255,7 +255,7 @@ public function subscribeToChannelPointsCustomRewardAdd(string $bearer, string $ /** * @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelchannel_points_custom_rewardupdate */ - public function subscribeToChannelPointsCustomRewardUpdate(string $bearer, string $secret, string $callback, string $twitchId, string $rewardId = null): ResponseInterface + public function subscribeToChannelPointsCustomRewardUpdate(string $bearer, string $secret, string $callback, string $twitchId, ?string $rewardId = null): ResponseInterface { return $this->subscribeToChannelPointsCustomReward($bearer, $secret, $callback, $twitchId, $rewardId, 'update'); } @@ -263,7 +263,7 @@ public function subscribeToChannelPointsCustomRewardUpdate(string $bearer, strin /** * @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelchannel_points_custom_rewardremove */ - public function subscribeToChannelPointsCustomRewardRemove(string $bearer, string $secret, string $callback, string $twitchId, string $rewardId = null): ResponseInterface + public function subscribeToChannelPointsCustomRewardRemove(string $bearer, string $secret, string $callback, string $twitchId, ?string $rewardId = null): ResponseInterface { return $this->subscribeToChannelPointsCustomReward($bearer, $secret, $callback, $twitchId, $rewardId, 'remove'); } @@ -279,7 +279,7 @@ public function subscribeToChannelPointsCustomRewardRedemptionAdd(string $bearer /** * @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelchannel_points_custom_reward_redemptionupdate */ - public function subscribeToChannelPointsCustomRewardRedemptionUpdate(string $bearer, string $secret, string $callback, string $twitchId, string $rewardId = null): ResponseInterface + public function subscribeToChannelPointsCustomRewardRedemptionUpdate(string $bearer, string $secret, string $callback, string $twitchId, ?string $rewardId = null): ResponseInterface { return $this->subscribeToChannelPointsCustomRewardRedemption($bearer, $secret, $callback, $twitchId, $rewardId, 'update'); } @@ -517,7 +517,7 @@ public function subscribeToChannelShoutoutReceive(string $bearer, string $secret /** * @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#dropentitlementgrant */ - public function subscribeToDropEntitlementGrant(string $bearer, string $secret, string $callback, string $organizationId, string $categoryId = null, string $campaign_id = null): ResponseInterface + public function subscribeToDropEntitlementGrant(string $bearer, string $secret, string $callback, string $organizationId, ?string $categoryId = null, ?string $campaign_id = null): ResponseInterface { $condition = ['organization_id' => $organizationId]; if ($categoryId) { @@ -561,7 +561,7 @@ private function subscribeToChannelModerator(string $bearer, string $secret, str ); } - private function subscribeToChannelPointsCustomReward(string $bearer, string $secret, string $callback, string $twitchId, string $rewardId = null, string $eventType): ResponseInterface + private function subscribeToChannelPointsCustomReward(string $bearer, string $secret, string $callback, string $twitchId, ?string $rewardId = null, string $eventType): ResponseInterface { $condition = ['broadcaster_user_id' => $twitchId]; @@ -579,7 +579,7 @@ private function subscribeToChannelPointsCustomReward(string $bearer, string $se ); } - private function subscribeToChannelPointsCustomRewardRedemption(string $bearer, string $secret, string $callback, string $twitchId, string $rewardId = null, string $eventType): ResponseInterface + private function subscribeToChannelPointsCustomRewardRedemption(string $bearer, string $secret, string $callback, string $twitchId, ?string $rewardId = null, string $eventType): ResponseInterface { $condition = ['broadcaster_user_id' => $twitchId]; diff --git a/src/Resources/GamesApi.php b/src/Resources/GamesApi.php index 6a850b2..a384e54 100644 --- a/src/Resources/GamesApi.php +++ b/src/Resources/GamesApi.php @@ -30,7 +30,7 @@ public function getGames(string $bearer, array $ids = [], array $names = []): Re * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-top-games */ - public function getTopGames(string $bearer, int $first = null, string $before = null, string $after = null): ResponseInterface + public function getTopGames(string $bearer, ?int $first = null, ?string $before = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/HypeTrainApi.php b/src/Resources/HypeTrainApi.php index 83b4022..92c4964 100644 --- a/src/Resources/HypeTrainApi.php +++ b/src/Resources/HypeTrainApi.php @@ -13,7 +13,7 @@ class HypeTrainApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-hype-train-events */ - public function getHypeTrainEvents(string $bearer, string $broadcasterId, int $first = null, string $cursor = null): ResponseInterface + public function getHypeTrainEvents(string $bearer, string $broadcasterId, ?int $first = null, ?string $cursor = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/ModerationApi.php b/src/Resources/ModerationApi.php index 6aae1b0..28c5809 100644 --- a/src/Resources/ModerationApi.php +++ b/src/Resources/ModerationApi.php @@ -13,7 +13,7 @@ class ModerationApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-banned-users */ - public function getBannedUsers(string $bearer, string $broadcasterId, array $ids = [], string $before = null, string $after = null, string $first = null): ResponseInterface + public function getBannedUsers(string $bearer, string $broadcasterId, array $ids = [], ?string $before = null, ?string $after = null, ?string $first = null): ResponseInterface { $queryParamsMap = []; @@ -42,7 +42,7 @@ public function getBannedUsers(string $bearer, string $broadcasterId, array $ids * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-moderators */ - public function getModerators(string $bearer, string $broadcasterId, array $ids = [], string $after = null, string $first = null): ResponseInterface + public function getModerators(string $bearer, string $broadcasterId, array $ids = [], ?string $after = null, ?string $first = null): ResponseInterface { $queryParamsMap = []; @@ -124,7 +124,7 @@ public function manageHeldAutoModMessage(string $bearer, string $userId, string * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#ban-user */ - public function banUser(string $bearer, string $broadcasterId, string $moderatorId, string $userId, string $reason, int $duration = null): ResponseInterface + public function banUser(string $bearer, string $broadcasterId, string $moderatorId, string $userId, string $reason, ?int $duration = null): ResponseInterface { $queryParamsMap = $bodyParamsMap = []; @@ -191,7 +191,7 @@ public function updateAutoModSettings(string $bearer, string $broadcasterId, str * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-blocked-terms */ - public function getBlockedTerms(string $bearer, string $broadcasterId, string $moderatorId, int $first = null, string $after = null): ResponseInterface + public function getBlockedTerms(string $bearer, string $broadcasterId, string $moderatorId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; $queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId]; @@ -242,7 +242,7 @@ public function removeBlockedTerm(string $bearer, string $broadcasterId, string * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#delete-chat-messages */ - public function deleteChatMessages(string $bearer, string $broadcasterId, string $moderatorId, string $messageId = null): ResponseInterface + public function deleteChatMessages(string $bearer, string $broadcasterId, string $moderatorId, ?string $messageId = null): ResponseInterface { $queryParamsMap = []; $queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId]; @@ -259,7 +259,7 @@ public function deleteChatMessages(string $bearer, string $broadcasterId, string * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-vips */ - public function getVips(string $bearer, string $broadcasterId, array $users = [], int $first = null, string $after = null): ResponseInterface + public function getVips(string $bearer, string $broadcasterId, array $users = [], ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; $queryParamsMap[] = ['key' => 'broadcaster_id', 'value' => $broadcasterId]; diff --git a/src/Resources/PollsApi.php b/src/Resources/PollsApi.php index d4ac2fb..88f9997 100644 --- a/src/Resources/PollsApi.php +++ b/src/Resources/PollsApi.php @@ -13,7 +13,7 @@ class PollsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-polls */ - public function getPolls(string $bearer, string $broadcasterId, array $ids = [], string $after = null, int $first = null): ResponseInterface + public function getPolls(string $bearer, string $broadcasterId, array $ids = [], ?string $after = null, ?int $first = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/PredictionsApi.php b/src/Resources/PredictionsApi.php index cb2c810..7955584 100644 --- a/src/Resources/PredictionsApi.php +++ b/src/Resources/PredictionsApi.php @@ -13,7 +13,7 @@ class PredictionsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-predictions */ - public function getPredictions(string $bearer, string $broadcasterId, array $ids = [], string $after = null, int $first = null): ResponseInterface + public function getPredictions(string $bearer, string $broadcasterId, array $ids = [], ?string $after = null, ?int $first = null): ResponseInterface { $queryParamsMap = []; @@ -54,7 +54,7 @@ public function createPrediction(string $bearer, string $broadcasterId, string $ * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#end-prediction */ - public function endPrediction(string $bearer, string $broadcasterId, string $pollId, string $status, string $winningOutcomeId = null): ResponseInterface + public function endPrediction(string $bearer, string $broadcasterId, string $pollId, string $status, ?string $winningOutcomeId = null): ResponseInterface { $bodyParamsMap = []; diff --git a/src/Resources/ScheduleApi.php b/src/Resources/ScheduleApi.php index ec4157b..f208479 100644 --- a/src/Resources/ScheduleApi.php +++ b/src/Resources/ScheduleApi.php @@ -13,7 +13,7 @@ class ScheduleApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-channel-stream-schedule */ - public function getChannelStreamSchedule(string $bearer, string $broadcasterId, array $ids = [], string $startTime = null, string $utcOffset = null, int $first = null, string $after = null): ResponseInterface + public function getChannelStreamSchedule(string $bearer, string $broadcasterId, array $ids = [], ?string $startTime = null, ?string $utcOffset = null, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -46,7 +46,7 @@ public function getChannelStreamSchedule(string $bearer, string $broadcasterId, * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-channel-icalendar */ - public function getChanneliCalendar(string $bearer = null, string $broadcasterId): ResponseInterface + public function getChanneliCalendar(?string $bearer = null, string $broadcasterId): ResponseInterface { // This endpoint at the time of addition does not require any authorization, so the bearer is null. // However, to prevent a breaking update in the future, it will remain the first function parameter. @@ -63,7 +63,7 @@ public function getChanneliCalendar(string $bearer = null, string $broadcasterId * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#update-channel-stream-schedule */ - public function updateChannelStreamSchedule(string $bearer, string $broadcasterId, bool $isVacationEnabled = null, $vacationStartTime = null, $vacationEndTime = null, $timezone = null): ResponseInterface + public function updateChannelStreamSchedule(string $bearer, string $broadcasterId, ?bool $isVacationEnabled = null, $vacationStartTime = null, $vacationEndTime = null, $timezone = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/SearchApi.php b/src/Resources/SearchApi.php index 55c43d5..a348042 100644 --- a/src/Resources/SearchApi.php +++ b/src/Resources/SearchApi.php @@ -13,7 +13,7 @@ class SearchApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#search-categories */ - public function searchCategories(string $bearer, string $query, string $first = null, string $after = null): ResponseInterface + public function searchCategories(string $bearer, string $query, ?string $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -34,7 +34,7 @@ public function searchCategories(string $bearer, string $query, string $first = * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#search-channels */ - public function searchChannels(string $bearer, string $query, $liveOnly = null, string $first = null, string $after = null): ResponseInterface + public function searchChannels(string $bearer, string $query, $liveOnly = null, ?string $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/StreamsApi.php b/src/Resources/StreamsApi.php index 545e541..46e10ed 100644 --- a/src/Resources/StreamsApi.php +++ b/src/Resources/StreamsApi.php @@ -28,7 +28,7 @@ public function getStreamForUsername(string $bearer, string $username): Response /** * @throws GuzzleException */ - public function getStreamsByGameId(string $bearer, string $gameId, int $first = null, string $before = null, string $after = null): ResponseInterface + public function getStreamsByGameId(string $bearer, string $gameId, ?int $first = null, ?string $before = null, ?string $after = null): ResponseInterface { return $this->getStreams($bearer, [], [], [$gameId]); } @@ -36,7 +36,7 @@ public function getStreamsByGameId(string $bearer, string $gameId, int $first = /** * @throws GuzzleException */ - public function getStreamsByLanguage(string $bearer, string $language, int $first = null, string $before = null, string $after = null): ResponseInterface + public function getStreamsByLanguage(string $bearer, string $language, ?int $first = null, ?string $before = null, ?string $after = null): ResponseInterface { return $this->getStreams($bearer, [], [], [], [$language]); } @@ -58,7 +58,7 @@ public function getStreamKey(string $bearer, string $broadcasterId): ResponseInt * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-streams */ - public function getStreams(string $bearer, array $userIds = [], array $usernames = [], array $gameIds = [], array $languages = [], int $first = null, string $before = null, string $after = null): ResponseInterface + public function getStreams(string $bearer, array $userIds = [], array $usernames = [], array $gameIds = [], array $languages = [], ?int $first = null, ?string $before = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; foreach ($userIds as $id) { @@ -90,7 +90,7 @@ public function getStreams(string $bearer, array $userIds = [], array $usernames * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-stream-markers */ - public function getStreamMarkers(string $bearer, string $userId = null, string $videoId = null, string $first = null, string $before = null, string $after = null): ResponseInterface + public function getStreamMarkers(string $bearer, ?string $userId = null, ?string $videoId = null, ?string $first = null, ?string $before = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -121,7 +121,7 @@ public function getStreamMarkers(string $bearer, string $userId = null, string $ * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-followed-streams */ - public function getFollowedStreams(string $bearer, string $userId, int $first = null, string $after = null): ResponseInterface + public function getFollowedStreams(string $bearer, string $userId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -142,7 +142,7 @@ public function getFollowedStreams(string $bearer, string $userId, int $first = * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#create-stream-marker */ - public function createStreamMarker(string $bearer, string $userId, string $description = null): ResponseInterface + public function createStreamMarker(string $bearer, string $userId, ?string $description = null): ResponseInterface { $bodyParamsMap = []; diff --git a/src/Resources/SubscriptionsApi.php b/src/Resources/SubscriptionsApi.php index 7422cbf..896a899 100644 --- a/src/Resources/SubscriptionsApi.php +++ b/src/Resources/SubscriptionsApi.php @@ -13,7 +13,7 @@ class SubscriptionsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-broadcaster-subscriptions */ - public function getBroadcasterSubscriptions(string $bearer, string $broadcasterId, int $first = null, string $after = null): ResponseInterface + public function getBroadcasterSubscriptions(string $bearer, string $broadcasterId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/TagsApi.php b/src/Resources/TagsApi.php index 0c14d11..d277182 100644 --- a/src/Resources/TagsApi.php +++ b/src/Resources/TagsApi.php @@ -13,7 +13,7 @@ class TagsApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-all-stream-tags */ - public function getAllStreamTags(string $bearer, array $tagIds = [], int $first = null, string $after = null): ResponseInterface + public function getAllStreamTags(string $bearer, array $tagIds = [], ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/TeamsApi.php b/src/Resources/TeamsApi.php index 3830fa8..ec28d1c 100644 --- a/src/Resources/TeamsApi.php +++ b/src/Resources/TeamsApi.php @@ -26,7 +26,7 @@ public function getChannelTeams(string $bearer, string $broadcasterId): Response * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-teams */ - public function getTeams(string $bearer, string $name = null, string $id = null): ResponseInterface + public function getTeams(string $bearer, ?string $name = null, ?string $id = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/UsersApi.php b/src/Resources/UsersApi.php index 715b7cc..6749a98 100644 --- a/src/Resources/UsersApi.php +++ b/src/Resources/UsersApi.php @@ -57,7 +57,7 @@ public function getUsers(string $bearer, array $ids = [], array $usernames = [], * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-users-follows */ - public function getUsersFollows(string $bearer, string $followerId = null, string $followedUserId = null, int $first = null, string $after = null): ResponseInterface + public function getUsersFollows(string $bearer, ?string $followerId = null, ?string $followedUserId = null, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; if ($followerId) { @@ -91,7 +91,7 @@ public function getUserExtensions(string $bearer): ResponseInterface * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-user-active-extensions */ - public function getActiveUserExtensions(string $bearer, string $userId = null): ResponseInterface + public function getActiveUserExtensions(string $bearer, ?string $userId = null): ResponseInterface { $queryParamsMap = []; @@ -106,7 +106,7 @@ public function getActiveUserExtensions(string $bearer, string $userId = null): * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#update-user */ - public function updateUser(string $bearer, string $description = null): ResponseInterface + public function updateUser(string $bearer, ?string $description = null): ResponseInterface { $queryParamsMap = []; @@ -121,7 +121,7 @@ public function updateUser(string $bearer, string $description = null): Response * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#get-user-block-list */ - public function getUserBlockList(string $bearer, string $broadcasterId, int $first = null, string $after = null): ResponseInterface + public function getUserBlockList(string $bearer, string $broadcasterId, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; @@ -141,7 +141,7 @@ public function getUserBlockList(string $bearer, string $broadcasterId, int $fir * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference#block-user */ - public function blockUser(string $bearer, string $targetUserId, string $sourceContext = null, string $reason = null): ResponseInterface + public function blockUser(string $bearer, string $targetUserId, ?string $sourceContext = null, ?string $reason = null): ResponseInterface { $queryParamsMap = []; diff --git a/src/Resources/VideosApi.php b/src/Resources/VideosApi.php index 17e4d00..3958351 100644 --- a/src/Resources/VideosApi.php +++ b/src/Resources/VideosApi.php @@ -13,7 +13,7 @@ class VideosApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-videos */ - 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 + 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 { $queryParamsMap = []; diff --git a/src/Resources/WebhooksApi.php b/src/Resources/WebhooksApi.php index b933ef2..5fc022f 100644 --- a/src/Resources/WebhooksApi.php +++ b/src/Resources/WebhooksApi.php @@ -13,7 +13,7 @@ class WebhooksApi extends AbstractResource * @throws GuzzleException * @link https://dev.twitch.tv/docs/api/reference/#get-webhook-subscriptions */ - public function getWebhookSubscriptions(string $bearer, int $first = null, string $after = null): ResponseInterface + public function getWebhookSubscriptions(string $bearer, ?int $first = null, ?string $after = null): ResponseInterface { $queryParamsMap = []; if ($first) { diff --git a/src/TwitchApi.php b/src/TwitchApi.php index 9955b2c..939205c 100644 --- a/src/TwitchApi.php +++ b/src/TwitchApi.php @@ -67,7 +67,7 @@ class TwitchApi private $whispersApi; private $webhooksSubscriptionApi; - public function __construct(HelixGuzzleClient $helixGuzzleClient, string $clientId, string $clientSecret, Client $authGuzzleClient = null) + public function __construct(HelixGuzzleClient $helixGuzzleClient, string $clientId, string $clientSecret, ?Client $authGuzzleClient = null) { $requestGenerator = new RequestGenerator(); $this->oauthApi = new OauthApi($clientId, $clientSecret, $authGuzzleClient); diff --git a/src/Webhooks/WebhooksSubscriptionApi.php b/src/Webhooks/WebhooksSubscriptionApi.php index 980f0eb..4c9d610 100644 --- a/src/Webhooks/WebhooksSubscriptionApi.php +++ b/src/Webhooks/WebhooksSubscriptionApi.php @@ -15,7 +15,7 @@ class WebhooksSubscriptionApi private $secret; private $guzzleClient; - public function __construct(string $clientId, string $secret, HelixGuzzleClient $guzzleClient = null) + public function __construct(string $clientId, string $secret, ?HelixGuzzleClient $guzzleClient = null) { $this->clientId = $clientId; $this->secret = $secret;