Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix php 8.4 implicit nullable deprecation warnings #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/TwitchApi/Resources/EventSubApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
6 changes: 3 additions & 3 deletions src/Auth/OauthApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand Down Expand Up @@ -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' : '';
Expand Down
2 changes: 1 addition & 1 deletion src/HelixGuzzleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/RequestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/AbstractResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/AnalyticsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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 = [];

Expand Down
6 changes: 3 additions & 3 deletions src/Resources/BitsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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 = [];

Expand All @@ -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 = [];

Expand Down
6 changes: 3 additions & 3 deletions src/Resources/ChannelPointsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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 = [];

Expand All @@ -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 = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/ChannelsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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 = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/CharityApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/ChatApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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 = [];

Expand Down
10 changes: 5 additions & 5 deletions src/Resources/ClipsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ 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);
}

/**
* @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);
}

/**
* @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);
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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 = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/EntitlementsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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 = [];

Expand Down
Loading