Skip to content
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

Fix deprecation warnings for implicitly nullable parameter types in PHP 8.4 #136

Merged
merged 1 commit into from
Mar 18, 2025
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
2 changes: 1 addition & 1 deletion src/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Contact extends AbstractResource
* @param ClientInterface|null $client
* @return Contact
*/
public static function merge($into, $from, ClientInterface $client = null)
public static function merge($into, $from, ?ClientInterface $client = null)
{
$result = (new static([], $client))
->getClient()
Expand Down
10 changes: 5 additions & 5 deletions src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function customAttributes()
* @param ClientInterface|null $client
* @return Customer|null
*/
public static function findByExternalId($externalId, ClientInterface $client = null)
public static function findByExternalId($externalId, ?ClientInterface $client = null)
{
if (gettype($externalId) == 'string') {
$externalId = ['external_id' => $externalId];
Expand All @@ -136,7 +136,7 @@ public static function findByExternalId($externalId, ClientInterface $client = n
* @param ClientInterface|null $client
* @return Collection|static
*/
public static function search($email, ClientInterface $client = null)
public static function search($email, ?ClientInterface $client = null)
{
$response = (new static([], $client))
->getClient()
Expand All @@ -154,7 +154,7 @@ public static function search($email, ClientInterface $client = null)
* @param ClientInterface|null $client
* @return bool
*/
public static function merge($from, $into, ClientInterface $client = null)
public static function merge($from, $into, ?ClientInterface $client = null)
{
(new static([], $client))
->getClient()
Expand All @@ -180,7 +180,7 @@ public static function merge($from, $into, ClientInterface $client = null)
* @param ClientInterface|null $client
* @return bool
*/
public static function unmerge($customer_uuid, $external_id, $data_source_uuid, array $move_to_new_customer = [], ClientInterface $client = null)
public static function unmerge($customer_uuid, $external_id, $data_source_uuid, array $move_to_new_customer = [], ?ClientInterface $client = null)
{
(new static([], $client))
->getClient()
Expand All @@ -206,7 +206,7 @@ public static function unmerge($customer_uuid, $external_id, $data_source_uuid,
* @param ClientInterface|null $client
* @return bool
*/
public static function connectSubscriptions($customerUUID, array $data = [], ClientInterface $client = null)
public static function connectSubscriptions($customerUUID, array $data = [], ?ClientInterface $client = null)
{
(new static([], $client))
->getClient()
Expand Down
4 changes: 2 additions & 2 deletions src/CustomerInvoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CustomerInvoices extends AbstractResource

public $customer_uuid;

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand All @@ -34,7 +34,7 @@ public function __construct(array $attr = [], ClientInterface $client = null)
}
}

public static function destroyAll($dataSourceUUID, $customerUUID, ClientInterface $client = null)
public static function destroyAll($dataSourceUUID, $customerUUID, ?ClientInterface $client = null)
{
(new static([], $client))
->getClient()
Expand Down
4 changes: 2 additions & 2 deletions src/Customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected static function getEntryClass()
* @param array $attr
* @param ClientInterface|null $client
*/
public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand All @@ -61,7 +61,7 @@ public function __construct(array $attr = [], ClientInterface $client = null)
* @return Collection|static
* @deprecated Use Customer.
*/
public static function search($email, ClientInterface $client = null)
public static function search($email, ?ClientInterface $client = null)
{
return Customer::search($email, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ChartMogulException.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ChartMogulException extends \RuntimeException implements ResponseException
* @param ResponseInterface|null $response ResponseInterface object
* @param \Exception|null $previous
*/
public function __construct($message, ResponseInterface $response = null, \Exception $previous = null)
public function __construct($message, ?ResponseInterface $response = null, ?\Exception $previous = null)
{
if ($response) {
$response->getBody()->rewind();
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class Client implements ClientInterface
* @codeCoverageIgnore
*/
public function __construct(
Configuration $config = null,
HttpClient $client = null,
RequestFactoryInterface $requestFactory = null
?Configuration $config = null,
?HttpClient $client = null,
?RequestFactoryInterface $requestFactory = null
) {
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->client = $client ?: Psr18ClientDiscovery::find();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Retry.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private function retryHTTPStatus($status)
return $status == 429 || ($status >= 500 && $status < 600);
}

protected function shouldRetry($attempt, $maxAttempts, ResponseInterface $response = null, \Exception $ex = null)
protected function shouldRetry($attempt, $maxAttempts, ?ResponseInterface $response = null, ?\Exception $ex = null)
{
if ($attempt >= $maxAttempts && !is_null($ex)) {
throw $ex;
Expand Down
2 changes: 1 addition & 1 deletion src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Invoice extends AbstractResource
public $line_items = [];
public $transactions = [];

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
18 changes: 9 additions & 9 deletions src/Metrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Metrics
* @param ClientInterface|null $client
* @return NSMetrics\AllKeyMetrics
*/
public static function all(array $options = [], ClientInterface $client = null)
public static function all(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\AllKeyMetrics::all($options, $client);
}
Expand All @@ -26,7 +26,7 @@ public static function all(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function arpa(array $options = [], ClientInterface $client = null)
public static function arpa(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\ARPAs::all($options, $client);
}
Expand All @@ -36,7 +36,7 @@ public static function arpa(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function arr(array $options = [], ClientInterface $client = null)
public static function arr(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\ARRs::all($options, $client);
}
Expand All @@ -46,7 +46,7 @@ public static function arr(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function asp(array $options = [], ClientInterface $client = null)
public static function asp(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\ASPs::all($options, $client);
}
Expand All @@ -56,7 +56,7 @@ public static function asp(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function customerChurnRate(array $options = [], ClientInterface $client = null)
public static function customerChurnRate(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\CustomerChurnRates::all($options, $client);
}
Expand All @@ -66,7 +66,7 @@ public static function customerChurnRate(array $options = [], ClientInterface $c
*
* @inheritDoc
*/
public static function customerCount(array $options = [], ClientInterface $client = null)
public static function customerCount(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\CustomerCounts::all($options, $client);
}
Expand All @@ -76,7 +76,7 @@ public static function customerCount(array $options = [], ClientInterface $clien
*
* @inheritDoc
*/
public static function mrr(array $options = [], ClientInterface $client = null)
public static function mrr(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\MRRs::all($options, $client);
}
Expand All @@ -86,7 +86,7 @@ public static function mrr(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function ltv(array $options = [], ClientInterface $client = null)
public static function ltv(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\LTVs::all($options, $client);
}
Expand All @@ -96,7 +96,7 @@ public static function ltv(array $options = [], ClientInterface $client = null)
*
* @inheritDoc
*/
public static function mrrChurnRate(array $options = [], ClientInterface $client = null)
public static function mrrChurnRate(array $options = [], ?ClientInterface $client = null)
{
return NSMetrics\MRRChurnRates::all($options, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/AbstractMetric.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected static function getEntryClass()
return static::ENTRY_CLASS;
}

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Activities.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static function getEntryClass()
return static::ENTRY_CLASS;
}

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Activity extends AbstractModel
* @param ClientInterface|null $client
* @return Activities
*/
public static function all(array $options = [], ClientInterface $client = null)
public static function all(array $options = [], ?ClientInterface $client = null)
{
return Activities::all($options, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/AllKeyMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static function getEntryClass()
return static::ENTRY_CLASS;
}

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Customers/Activities.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static function getEntryClass()
return static::ENTRY_CLASS;
}

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Customers/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Activity extends AbstractModel
* @param ClientInterface|null $client
* @return Activities
*/
public static function all(array $options = [], ClientInterface $client = null)
public static function all(array $options = [], ?ClientInterface $client = null)
{
return Activities::all($options, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Customers/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Subscription extends AbstractModel
* @param ClientInterface|null $client
* @return Subscriptions
*/
public static function all(array $options = [], ClientInterface $client = null)
public static function all(array $options = [], ?ClientInterface $client = null)
{
return Subscriptions::all($options, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Customers/Subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static function getEntryClass()
return static::ENTRY_CLASS;
}

public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr, $client);

Expand Down
2 changes: 1 addition & 1 deletion src/Ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Ping extends AbstractResource

public $data;

public static function ping(ClientInterface $client = null)
public static function ping(?ClientInterface $client = null)
{
return Ping::all([], $client);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Resource/AbstractResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AbstractResource extends AbstractModel
* @param ClientInterface|null $client
* @return self
*/
public function __construct(array $attr = [], ClientInterface $client = null)
public function __construct(array $attr = [], ?ClientInterface $client = null)
{
parent::__construct($attr);

Expand Down Expand Up @@ -69,7 +69,7 @@ public function setClient(ClientInterface $client)
* @param ClientInterface|null $client
* @return Collection|static
*/
public static function fromArray(array $data, ClientInterface $client = null)
public static function fromArray(array $data, ?ClientInterface $client = null)
{
if (isset($data[static::ROOT_KEY])) {
if (static::ROOT_KEY != "subscription_events") {
Expand Down
2 changes: 1 addition & 1 deletion src/Service/AllTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait AllTrait
* @param ClientInterface|null $client 0
* @return Collection|self[]|self
*/
public static function all(array $data = [], ClientInterface $client = null)
public static function all(array $data = [], ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Service/CreateTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait CreateTrait
* @param ClientInterface|null $client
* @return self
*/
public static function create(array $data = [], ClientInterface $client = null)
public static function create(array $data = [], ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Service/DestroyWithParamsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait DestroyWithParamsTrait
*
* @return boolean
*/
public static function destroyWithParams(array $params = [], ClientInterface $client = null)
public static function destroyWithParams(array $params = [], ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Service/FromArrayTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait FromArrayTrait
* @param ClientInterface|null $client
* @return CollectionWithCursor|static
*/
public static function fromArray(array $data, ClientInterface $client = null)
public static function fromArray(array $data, ?ClientInterface $client = null)
{
if (isset($data[static::ROOT_KEY])) {
$array = new CollectionWithCursor(
Expand Down
4 changes: 2 additions & 2 deletions src/Service/GetTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ trait GetTrait
*
* @return resource
*/
public static function retrieve($uuid, ClientInterface $client = null)
public static function retrieve($uuid, ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
->get($uuid);
}

public static function get($uuid, ClientInterface $client = null)
public static function get($uuid, ?ClientInterface $client = null)
{
return static::retrieve($uuid, $client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/RequestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RequestService
private $resourcePath;
private $client;

public function __construct(ClientInterface $client = null)
public function __construct(?ClientInterface $client = null)
{
if (is_null($client)) {
$client = new Client();
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ShowTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait ShowTrait
* @return resource
*/

public static function retrieve(ClientInterface $client = null)
public static function retrieve(?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Service/UpdateTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait UpdateTrait
* @param ClientInterface|null $client
* @return self
*/
public static function update(array $id = [], array $data = [], ClientInterface $client = null)
public static function update(array $id = [], array $data = [], ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Service/UpdateWithParamsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait UpdateWithParamsTrait
* @param ClientInterface|null $client
* @return self
*/
public static function updateWithParams(array $params = [], ClientInterface $client = null)
public static function updateWithParams(array $params = [], ?ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
Expand Down
Loading
Loading