diff --git a/src/Contact.php b/src/Contact.php index f554830..0972969 100644 --- a/src/Contact.php +++ b/src/Contact.php @@ -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() diff --git a/src/Customer.php b/src/Customer.php index 174aed1..4ca31b6 100644 --- a/src/Customer.php +++ b/src/Customer.php @@ -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]; @@ -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() @@ -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() @@ -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() @@ -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() diff --git a/src/CustomerInvoices.php b/src/CustomerInvoices.php index c3ca903..fe9fc6a 100644 --- a/src/CustomerInvoices.php +++ b/src/CustomerInvoices.php @@ -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); @@ -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() diff --git a/src/Customers.php b/src/Customers.php index 7e9609b..3e08057 100644 --- a/src/Customers.php +++ b/src/Customers.php @@ -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); @@ -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); } diff --git a/src/Exceptions/ChartMogulException.php b/src/Exceptions/ChartMogulException.php index c378abd..30fd3c9 100644 --- a/src/Exceptions/ChartMogulException.php +++ b/src/Exceptions/ChartMogulException.php @@ -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(); diff --git a/src/Http/Client.php b/src/Http/Client.php index 7567202..1348a43 100644 --- a/src/Http/Client.php +++ b/src/Http/Client.php @@ -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(); diff --git a/src/Http/Retry.php b/src/Http/Retry.php index f4cd24b..aaeb13d 100644 --- a/src/Http/Retry.php +++ b/src/Http/Retry.php @@ -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; diff --git a/src/Invoice.php b/src/Invoice.php index ed2d03f..43b34f6 100644 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -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); diff --git a/src/Metrics.php b/src/Metrics.php index ead0ecc..5de4d44 100644 --- a/src/Metrics.php +++ b/src/Metrics.php @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/src/Metrics/AbstractMetric.php b/src/Metrics/AbstractMetric.php index 2227b85..920ae65 100644 --- a/src/Metrics/AbstractMetric.php +++ b/src/Metrics/AbstractMetric.php @@ -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); diff --git a/src/Metrics/Activities.php b/src/Metrics/Activities.php index 9312394..1bf0377 100644 --- a/src/Metrics/Activities.php +++ b/src/Metrics/Activities.php @@ -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); diff --git a/src/Metrics/Activity.php b/src/Metrics/Activity.php index 9368a55..8d007ce 100644 --- a/src/Metrics/Activity.php +++ b/src/Metrics/Activity.php @@ -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); } diff --git a/src/Metrics/AllKeyMetrics.php b/src/Metrics/AllKeyMetrics.php index 6b27262..efe382b 100644 --- a/src/Metrics/AllKeyMetrics.php +++ b/src/Metrics/AllKeyMetrics.php @@ -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); diff --git a/src/Metrics/Customers/Activities.php b/src/Metrics/Customers/Activities.php index e022511..5d7f727 100644 --- a/src/Metrics/Customers/Activities.php +++ b/src/Metrics/Customers/Activities.php @@ -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); diff --git a/src/Metrics/Customers/Activity.php b/src/Metrics/Customers/Activity.php index 15b7991..2be81d6 100644 --- a/src/Metrics/Customers/Activity.php +++ b/src/Metrics/Customers/Activity.php @@ -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); } diff --git a/src/Metrics/Customers/Subscription.php b/src/Metrics/Customers/Subscription.php index 1d1380d..affe3e7 100644 --- a/src/Metrics/Customers/Subscription.php +++ b/src/Metrics/Customers/Subscription.php @@ -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); } diff --git a/src/Metrics/Customers/Subscriptions.php b/src/Metrics/Customers/Subscriptions.php index b046053..458a9c8 100644 --- a/src/Metrics/Customers/Subscriptions.php +++ b/src/Metrics/Customers/Subscriptions.php @@ -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); diff --git a/src/Ping.php b/src/Ping.php index b5696a9..fcaffe5 100644 --- a/src/Ping.php +++ b/src/Ping.php @@ -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); } diff --git a/src/Resource/AbstractResource.php b/src/Resource/AbstractResource.php index be9ea71..a07ce59 100644 --- a/src/Resource/AbstractResource.php +++ b/src/Resource/AbstractResource.php @@ -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); @@ -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") { diff --git a/src/Service/AllTrait.php b/src/Service/AllTrait.php index 5ae5b04..80c7ae9 100644 --- a/src/Service/AllTrait.php +++ b/src/Service/AllTrait.php @@ -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) diff --git a/src/Service/CreateTrait.php b/src/Service/CreateTrait.php index eafc12d..a0806e1 100644 --- a/src/Service/CreateTrait.php +++ b/src/Service/CreateTrait.php @@ -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) diff --git a/src/Service/DestroyWithParamsTrait.php b/src/Service/DestroyWithParamsTrait.php index d6f697c..736d716 100644 --- a/src/Service/DestroyWithParamsTrait.php +++ b/src/Service/DestroyWithParamsTrait.php @@ -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) diff --git a/src/Service/FromArrayTrait.php b/src/Service/FromArrayTrait.php index dd2dfd9..b035107 100644 --- a/src/Service/FromArrayTrait.php +++ b/src/Service/FromArrayTrait.php @@ -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( diff --git a/src/Service/GetTrait.php b/src/Service/GetTrait.php index 217732d..e39e25e 100644 --- a/src/Service/GetTrait.php +++ b/src/Service/GetTrait.php @@ -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); } diff --git a/src/Service/RequestService.php b/src/Service/RequestService.php index 1a2c414..9160896 100644 --- a/src/Service/RequestService.php +++ b/src/Service/RequestService.php @@ -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(); diff --git a/src/Service/ShowTrait.php b/src/Service/ShowTrait.php index e392990..250dac7 100644 --- a/src/Service/ShowTrait.php +++ b/src/Service/ShowTrait.php @@ -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) diff --git a/src/Service/UpdateTrait.php b/src/Service/UpdateTrait.php index 869e0c5..4cf226c 100644 --- a/src/Service/UpdateTrait.php +++ b/src/Service/UpdateTrait.php @@ -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) diff --git a/src/Service/UpdateWithParamsTrait.php b/src/Service/UpdateWithParamsTrait.php index 5d898aa..0197828 100644 --- a/src/Service/UpdateWithParamsTrait.php +++ b/src/Service/UpdateWithParamsTrait.php @@ -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) diff --git a/src/Subscription.php b/src/Subscription.php index 1d04b2b..5f9042d 100644 --- a/src/Subscription.php +++ b/src/Subscription.php @@ -93,7 +93,7 @@ public function setCancellationDates($cancellationDates) /** * @inheritDoc */ - public static function fromArray(array $data, ClientInterface $client = null) + public static function fromArray(array $data, ?ClientInterface $client = null) { $result = parent::fromArray($data, $client); if (isset($data["customer_uuid"]) && $result instanceof Collection) {