Skip to content

Commit d6ab64a

Browse files
Fix getApiLimit in a way that variables only have one type
1 parent d2d0fa6 commit d6ab64a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Github/HttpClient/Message/ResponseMediator.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ public static function getPagination(ResponseInterface $response)
5656
*/
5757
public static function getApiLimit(ResponseInterface $response)
5858
{
59-
$remainingCalls = self::getHeader($response, 'X-RateLimit-Remaining');
59+
$remainingCallsHeader = self::getHeader($response, 'X-RateLimit-Remaining');
6060

61-
if (null !== $remainingCalls && 1 > $remainingCalls) {
61+
if (null === $remainingCallsHeader) {
62+
return null;
63+
}
64+
65+
$remainingCalls = (int) $remainingCallsHeader;
66+
67+
if (1 > $remainingCalls) {
6268
throw new ApiLimitExceedException((int) $remainingCalls);
6369
}
6470

0 commit comments

Comments
 (0)