Skip to content

Commit 67697a3

Browse files
committed
Resolve issues with it_should_create_a_follow_without_notifications
1 parent 01ec1f1 commit 67697a3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/NewTwitchApi/Resources/AbstractResource.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ protected function generateQueryParams(array $queryParamsMap): string
5858
{
5959
$queryStringParams = '';
6060
foreach ($queryParamsMap as $paramMap) {
61-
if ($paramMap['value']) {
61+
if ($paramMap['value'] !== null) {
62+
if (is_bool($paramMap['value'])) {
63+
$paramMap['value'] = (int) $paramMap['value'];
64+
}
6265
$format = is_int($paramMap['value']) ? '%d' : '%s';
6366
$queryStringParams .= sprintf('&%s='.$format, $paramMap['key'], $paramMap['value']);
6467
}

src/NewTwitchApi/Resources/UsersApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function createUserFollow(string $bearer, string $fromId, string $toId, b
114114

115115
$queryParamsMap[] = ['key' => 'to_id', 'value' => $toId];
116116

117-
if (!is_null($notifications)) {
117+
if ($notifications !== null) {
118118
$queryParamsMap[] = ['key' => 'allow_notifications', 'value' => $notifications];
119119
}
120120

0 commit comments

Comments
 (0)