diff --git a/README.md b/README.md index 06f5eb7..13d2555 100755 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ $result = $api->graph(...); Requests are made using Guzzle. ```php -$api->rest(string $type, string $path, array $params = null, array $headers = [], bool $sync = true); +$api->rest(string $type, string $path, ?array $params = null, array $headers = [], bool $sync = true); // or $api->getRestClient()->request(....); ``` diff --git a/src/BasicShopifyAPI.php b/src/BasicShopifyAPI.php index 92d121a..f909183 100755 --- a/src/BasicShopifyAPI.php +++ b/src/BasicShopifyAPI.php @@ -426,7 +426,7 @@ public function graphAsync(string $query, array $variables = []): Promise /** * @see Rest::request */ - public function rest(string $type, string $path, array $params = null, array $headers = [], bool $sync = true) + public function rest(string $type, string $path, ?array $params = null, array $headers = [], bool $sync = true) { return $this->getRestClient()->request($type, $path, $params, $headers, $sync); } @@ -437,7 +437,7 @@ public function rest(string $type, string $path, array $params = null, array $he * * @see rest */ - public function restAsync(string $type, string $path, array $params = null, array $headers = []): Promise + public function restAsync(string $type, string $path, ?array $params = null, array $headers = []): Promise { return $this->rest($type, $path, $params, $headers, false); } diff --git a/src/Clients/Rest.php b/src/Clients/Rest.php index b9d7cef..bc24d01 100644 --- a/src/Clients/Rest.php +++ b/src/Clients/Rest.php @@ -103,7 +103,7 @@ public function getAuthUrl($scopes, string $redirectUri, string $mode = 'offline /** * {@inheritdoc} */ - public function request(string $type, string $path, array $params = null, array $headers = [], bool $sync = true) + public function request(string $type, string $path, ?array $params = null, array $headers = [], bool $sync = true) { // Build URI $uri = $this->getBaseUri()->withPath($path); diff --git a/src/Contracts/RestRequester.php b/src/Contracts/RestRequester.php index 4302b05..da081dc 100644 --- a/src/Contracts/RestRequester.php +++ b/src/Contracts/RestRequester.php @@ -25,7 +25,7 @@ interface RestRequester extends LimitAccesser, TimeAccesser, SessionAware, Clien * * @return array|Promise */ - public function request(string $type, string $path, array $params = null, array $headers = [], bool $sync = true); + public function request(string $type, string $path, ?array $params = null, array $headers = [], bool $sync = true); /** * Gets the access object from a "code" supplied by Shopify request after successfull auth (for public apps).