Skip to content

Commit

Permalink
Fix type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xHeaven committed Jul 11, 2024
1 parent 8f6086b commit 25e3f2d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/GraphQLClientMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class GraphQLClientMethods
{
use Macroable;

private ?int $maxAvailableLimit = null;
private float|int|null $maxAvailableLimit = null;

private ?int $lastAvailableLimit = null;
private float|int|null $lastAvailableLimit = null;

private ?int $restoreRate = null;
private float|int|null $restoreRate = null;

public function __construct(
private readonly AbstractAppAuthenticator $appAuthenticator,
Expand Down Expand Up @@ -95,9 +95,9 @@ public function mutate(string $query, array $variables, bool $withExtensions = f
}

#[ArrayShape([
'maxAvailableLimit' => 'int',
'lastAvailableLimit' => 'int',
'restoreRate' => 'int',
'maxAvailableLimit' => 'float|int|null',
'lastAvailableLimit' => 'float|int|null',
'restoreRate' => 'float|int|null',
])]
public function getRateLimitInfo(): array
{
Expand All @@ -120,16 +120,16 @@ private function ispectResponse(
return;
}

/** @var ?int $requestedQueryCost */
/** @var float|int|null $requestedQueryCost */
$requestedQueryCost = data_get($response, 'extensions.cost.requestedQueryCost');
/** @var ?int $actualQueryCost */
/** @var float|int|null $actualQueryCost */
$actualQueryCost = data_get($response, 'extensions.cost.actualQueryCost');

/** @var ?int $maxAvailableLimit */
/** @var float|int|null $maxAvailableLimit */
$maxAvailableLimit = data_get($response, 'extensions.cost.throttleStatus.maximumAvailable');
/** @var ?int $lastAvailableLimit */
/** @var float|int|null $lastAvailableLimit */
$lastAvailableLimit = data_get($response, 'extensions.cost.throttleStatus.currentlyAvailable');
/** @var ?int $restoreRate */
/** @var float|int|null $restoreRate */
$restoreRate = data_get($response, 'extensions.cost.throttleStatus.restoreRate');

$this->updateRateLimitInfo($maxAvailableLimit, $lastAvailableLimit, $restoreRate);
Expand Down Expand Up @@ -165,7 +165,7 @@ private function ispectResponse(
}
}

private function updateRateLimitInfo(?int $maxAvailable, ?int $lastAvailable, ?int $restoreRate): void
private function updateRateLimitInfo(float|int|null $maxAvailable, float|int|null $lastAvailable, float|int|null $restoreRate): void
{
$this->maxAvailableLimit = $maxAvailable;
$this->lastAvailableLimit = $lastAvailable;
Expand Down

0 comments on commit 25e3f2d

Please sign in to comment.