-
Notifications
You must be signed in to change notification settings - Fork 67
fix: remove PHP 8.4 deprecation warning #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (C) 2023, Twilio SendGrid, Inc. <[email protected]> | ||
Copyright (C) 2025, Twilio SendGrid, Inc. <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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|null $headers global request headers | ||||||||||||||
* @param string|null $version api version (configurable) - this is specific to the SendGrid API | ||||||||||||||
* @param array|null $path holds the segments of the url path | ||||||||||||||
* @param array|null $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 | ||||||||||||||
?array $headers = null, | ||||||||||||||
?string $version = null, | ||||||||||||||
?array $path = null, | ||||||||||||||
?array $curlOptions = null, | ||||||||||||||
bool $retryOnLimit = false, | ||||||||||||||
bool $verifySSLCerts = true | ||||||||||||||
) { | ||||||||||||||
$this->host = $host; | ||||||||||||||
$this->headers = $headers ?: []; | ||||||||||||||
|
@@ -263,7 +263,7 @@ public function getHost() | |||||||||||||
public function setHost(string $host) | ||||||||||||||
{ | ||||||||||||||
$this->host = $host; | ||||||||||||||
|
||||||||||||||
return $this; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
@@ -358,13 +358,13 @@ public function setIsConcurrentRequest($isConcurrent) | |||||||||||||
/** | ||||||||||||||
* Build the final URL to be passed. | ||||||||||||||
* | ||||||||||||||
* @param array $queryParams an array of all the query parameters | ||||||||||||||
* @param array|null $queryParams an array of all the query parameters | ||||||||||||||
tiwarishubham635 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
* | ||||||||||||||
* Nested arrays will resolve to multiple instances of the same parameter | ||||||||||||||
* | ||||||||||||||
* @return string | ||||||||||||||
*/ | ||||||||||||||
private function buildUrl($queryParams = null) | ||||||||||||||
private function buildUrl(?array $queryParams = null) | ||||||||||||||
{ | ||||||||||||||
$path = '/' . implode('/', $this->path); | ||||||||||||||
if (isset($queryParams)) { | ||||||||||||||
|
@@ -380,12 +380,12 @@ private function buildUrl($queryParams = null) | |||||||||||||
* this function does not mutate any private variables. | ||||||||||||||
* | ||||||||||||||
* @param string $method | ||||||||||||||
* @param array $body | ||||||||||||||
* @param array $headers | ||||||||||||||
* @param array|null $body | ||||||||||||||
* @param array|null $headers | ||||||||||||||
* | ||||||||||||||
* @return array | ||||||||||||||
*/ | ||||||||||||||
private function createCurlOptions($method, $body = null, $headers = null) | ||||||||||||||
private function createCurlOptions($method, ?array $body = null, ?array $headers = null) | ||||||||||||||
{ | ||||||||||||||
$options = [ | ||||||||||||||
CURLOPT_RETURNTRANSFER => true, | ||||||||||||||
|
@@ -498,17 +498,17 @@ private function retryRequest(array $responseHeaders, $method, $url, $body, $hea | |||||||||||||
* Make the API call and return the response. | ||||||||||||||
* This is separated into it's own function, so we can mock it easily for testing. | ||||||||||||||
* | ||||||||||||||
* @param string $method the HTTP verb | ||||||||||||||
* @param string $url the final url to call | ||||||||||||||
* @param array $body request body | ||||||||||||||
* @param array $headers any additional request headers | ||||||||||||||
* @param bool $retryOnLimit should retry if rate limit is reach? | ||||||||||||||
* @param string $method the HTTP verb | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add backslashes before the parameter names? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed |
||||||||||||||
* @param string $url the final url to call | ||||||||||||||
* @param array|null $body request body | ||||||||||||||
* @param array|null $headers any additional request headers | ||||||||||||||
* @param bool $retryOnLimit should retry if rate limit is reach? | ||||||||||||||
* | ||||||||||||||
* @return Response object | ||||||||||||||
* | ||||||||||||||
* @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); | ||||||||||||||
|
||||||||||||||
|
@@ -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; | ||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.