Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,22 @@ class Client
/**
* Initialize the client.
*
* @param string $host the base url (e.g. https://api.sendgrid.com)
* @param array $headers global request headers
* @param string $version api version (configurable) - this is specific to the SendGrid API
* @param array $path holds the segments of the url path
* @param array $curlOptions extra options to set during curl initialization
* @param bool $retryOnLimit set default retry on limit flag
* @param bool $verifySSLCerts set default verify certificates flag
* @param string $host The base url (e.g. https://api.sendgrid.com)
* @param array $headers Global request headers
* @param string $version Api version (configurable) - this is specific to the SendGrid API
* @param array $path Holds the segments of the url path
* @param array $curlOptions Extra options to set during curl initialization
* @param bool $retryOnLimit Set default retry on limit flag
* @param bool $verifySSLCerts Set default verify certificates flag
*/
public function __construct(
$host,
$headers = null,
$version = null,
$path = null,
$curlOptions = null,
$retryOnLimit = false,
$verifySSLCerts = true
string $host,
?array $headers = null,
?string $version = null,
?array $path = null,
?array $curlOptions = null,
bool $retryOnLimit = false,
bool $verifySSLCerts = true
) {
$this->host = $host;
$this->headers = $headers ?: [];
Expand Down Expand Up @@ -263,7 +263,7 @@ public function getHost()
public function setHost(string $host)
{
$this->host = $host;

return $this;
}

Expand Down Expand Up @@ -364,7 +364,7 @@ public function setIsConcurrentRequest($isConcurrent)
*
* @return string
*/
private function buildUrl($queryParams = null)
private function buildUrl(?array $queryParams = null)
{
$path = '/' . implode('/', $this->path);
if (isset($queryParams)) {
Expand All @@ -385,7 +385,7 @@ private function buildUrl($queryParams = null)
*
* @return array
*/
private function createCurlOptions($method, $body = null, $headers = null)
private function createCurlOptions($method, ?array $body = null, ?array $headers = null)
{
$options = [
CURLOPT_RETURNTRANSFER => true,
Expand Down Expand Up @@ -508,7 +508,7 @@ private function retryRequest(array $responseHeaders, $method, $url, $body, $hea
*
* @throws InvalidRequest
*/
public function makeRequest($method, $url, $body = null, $headers = null, $retryOnLimit = false)
public function makeRequest($method, $url, ?array $body = null, ?array $headers = null, $retryOnLimit = false)
{
$channel = curl_init($url);

Expand Down Expand Up @@ -604,7 +604,7 @@ public function makeAllRequests(array $requests = [])
*
* @return Client object
*/
public function _($name = null)
public function _(?string $name = null)
{
if (isset($name)) {
$this->path[] = $name;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/MockClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MockClient extends Client
public $requestHeaders;
public $url;

public function makeRequest($method, $url, $requestBody = null, $requestHeaders = null, $retryOnLimit = false)
public function makeRequest($method, $url, ?array $requestBody = null, ?array $requestHeaders = null, $retryOnLimit = false)
{
$this->requestBody = $requestBody;
$this->requestHeaders = $requestHeaders;
Expand Down
Loading