diff --git a/src/GraphQLClientMethods.php b/src/GraphQLClientMethods.php index 6c46a93..a8f56d4 100644 --- a/src/GraphQLClientMethods.php +++ b/src/GraphQLClientMethods.php @@ -161,6 +161,7 @@ private function makeQueryRequest(string $query, bool $withExtensions = false, b if ($this->tries < config('shopify-graphql.throttle_max_tries')) { $this->tries++; + // @phpstan-ignore method.nonObject $this->rateLimitService->waitIfNecessary((float)$this->requestedQueryCost); return $this->makeQueryRequest($query, $withExtensions, $detailedCost); @@ -192,6 +193,7 @@ private function makeMutationRequest(string $query, array $variables, bool $with if ($this->tries < config('shopify-graphql.throttle_max_tries')) { $this->tries++; + // @phpstan-ignore method.nonObject $this->rateLimitService->waitIfNecessary((float)$this->requestedQueryCost); return $this->makeMutationRequest($query, $variables, $withExtensions, $detailedCost); @@ -278,6 +280,8 @@ private function updateRateLimitInfo(array $response): void 'currentlyAvailable' => $this->currentlyAvailable, 'restoreRate' => $this->restoreRate, ]; + + // @phpstan-ignore method.nonObject $this->rateLimitService->updateRateLimitInfo($rateLimitData); } diff --git a/src/Services/QueryTransformer.php b/src/Services/QueryTransformer.php index f95a017..5c8ff40 100644 --- a/src/Services/QueryTransformer.php +++ b/src/Services/QueryTransformer.php @@ -7,6 +7,7 @@ use GraphQL\Language\AST\ArgumentNode; use GraphQL\Language\AST\FieldNode; use GraphQL\Language\AST\NameNode; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\NodeList; use GraphQL\Language\AST\SelectionSetNode; use GraphQL\Language\Parser; @@ -55,10 +56,12 @@ public static function transformQueryWithPagination(string $queryString, array $ private static function applyPaginationArguments(NodeList $arguments, array $paginationArgs): NodeList { + /** @var Node[] $argsArray */ $argsArray = iterator_to_array($arguments); $argsMap = []; foreach ($argsArray as $argNode) { + // @phpstan-ignore property.notFound $argsMap[$argNode->name->value] = $argNode; } @@ -86,10 +89,6 @@ private static function phpValueToGraphQLLiteral(mixed $value): string return (string)$value; } - if (is_string($value)) { - return json_encode($value, JSON_UNESCAPED_UNICODE); - } - if (is_array($value)) { if (Arr::isAssoc($value)) { $fields = []; @@ -105,6 +104,6 @@ private static function phpValueToGraphQLLiteral(mixed $value): string return '[' . implode(', ', $items) . ']'; } - return json_encode((string)$value, JSON_UNESCAPED_UNICODE); + return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); } }