Skip to content

Commit 52078c2

Browse files
maticalmiguelrs
andauthored
Fix "implicit nulls" deprecation warnings for PHP 8.4 (#328)
Co-authored-by: Miguel Rosales Sueiro <[email protected]>
1 parent cd377dd commit 52078c2

File tree

13 files changed

+27
-31
lines changed

13 files changed

+27
-31
lines changed

src/Conversations/ConversationsEndpoint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class ConversationsEndpoint extends Endpoint
1717
{
18-
public function get(int $id, ConversationRequest $conversationRequest = null): Conversation
18+
public function get(int $id, ?ConversationRequest $conversationRequest = null): Conversation
1919
{
2020
$conversationResource = $this->restClient->getResource(Conversation::class, sprintf('/v2/conversations/%d', $id));
2121

@@ -96,8 +96,8 @@ public function updateTags(int $conversationId, $tags): void
9696
* @return Conversation[]|PagedCollection
9797
*/
9898
public function list(
99-
ConversationFilters $conversationFilters = null,
100-
ConversationRequest $conversationRequest = null
99+
?ConversationFilters $conversationFilters = null,
100+
?ConversationRequest $conversationRequest = null
101101
): PagedCollection {
102102
$uri = '/v2/conversations';
103103
if ($conversationFilters) {

src/Conversations/CustomerWaitingSince.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function extract(): array
5555
return $fields;
5656
}
5757

58-
public function setTime(DateTime $time = null): self
58+
public function setTime(?DateTime $time = null): self
5959
{
6060
$this->time = $time;
6161

src/Customers/Customer.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public function getCreatedAt(): ?DateTime
261261
return $this->createdAt;
262262
}
263263

264-
public function setCreatedAt(DateTime $createdAt = null): Customer
264+
public function setCreatedAt(?DateTime $createdAt = null): Customer
265265
{
266266
$this->createdAt = $createdAt;
267267

@@ -273,7 +273,7 @@ public function getUpdatedAt(): ?DateTime
273273
return $this->updatedAt;
274274
}
275275

276-
public function setUpdatedAt(DateTime $updatedAt = null): Customer
276+
public function setUpdatedAt(?DateTime $updatedAt = null): Customer
277277
{
278278
$this->updatedAt = $updatedAt;
279279

@@ -432,9 +432,8 @@ public function setChatHandles(Collection $chats): Customer
432432

433433
/**
434434
* @param ChatHandle|string $chat
435-
* @param string $type
436435
*/
437-
public function addChatHandle($chat, string $type = null): Customer
436+
public function addChatHandle($chat, ?string $type = null): Customer
438437
{
439438
if (is_string($chat)) {
440439
$newChatHandle = new ChatHandle();
@@ -480,9 +479,8 @@ public function setEmails(Collection $emails): Customer
480479

481480
/**
482481
* @param Email|string $email
483-
* @param string $type
484482
*/
485-
public function addEmail($email, string $type = null): Customer
483+
public function addEmail($email, ?string $type = null): Customer
486484
{
487485
if (is_string($email)) {
488486
$newEmail = new Email();
@@ -528,9 +526,8 @@ public function setPhones(Collection $phones): Customer
528526

529527
/**
530528
* @param Phone|string $phone
531-
* @param string $type
532529
*/
533-
public function addPhone($phone, string $type = null): Customer
530+
public function addPhone($phone, ?string $type = null): Customer
534531
{
535532
if (is_string($phone)) {
536533
$newPhone = new Phone();
@@ -566,9 +563,8 @@ public function setSocialProfiles(Collection $socialProfiles): Customer
566563

567564
/**
568565
* @param SocialProfile|string $profile
569-
* @param string $type
570566
*/
571-
public function addSocialProfile($profile, string $type = null): Customer
567+
public function addSocialProfile($profile, ?string $type = null): Customer
572568
{
573569
if (is_string($profile)) {
574570
$newProfile = new SocialProfile();

src/Customers/CustomersEndpoint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function update(Customer $customer): void
3434
);
3535
}
3636

37-
public function get(int $id, CustomerRequest $customerRequest = null): Customer
37+
public function get(int $id, ?CustomerRequest $customerRequest = null): Customer
3838
{
3939
$customerResource = $this->restClient->getResource(
4040
Customer::class,
@@ -51,8 +51,8 @@ public function get(int $id, CustomerRequest $customerRequest = null): Customer
5151
* @return Customer[]|PagedCollection
5252
*/
5353
public function list(
54-
CustomerFilters $customerFilters = null,
55-
CustomerRequest $customerRequest = null
54+
?CustomerFilters $customerFilters = null,
55+
?CustomerRequest $customerRequest = null
5656
): PagedCollection {
5757
$uri = '/v2/customers';
5858
if ($customerFilters) {

src/Exception/ValidationErrorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(
2424
VndError $error,
2525
RequestInterface $request,
2626
ResponseInterface $response,
27-
\Exception $previous = null
27+
?\Exception $previous = null
2828
) {
2929
// Append some details on what steps to take to see the underlying validation problems are.
3030
$message = $message.' - use getError() to see the underlying validation issues';

src/Http/Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Authenticator
4949
*/
5050
private $tokenRefreshedCallback;
5151

52-
public function __construct(Client $client, Auth $auth = null)
52+
public function __construct(Client $client, ?Auth $auth = null)
5353
{
5454
$this->client = $client;
5555
$this->auth = $auth ?? new NullCredentials();

src/Http/Hal/VndError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class VndError
2626
*/
2727
private $errors = [];
2828

29-
public function __construct(string $message, string $logRef = null, string $path = null)
29+
public function __construct(string $message, ?string $logRef = null, ?string $path = null)
3030
{
3131
$this->message = $message;
3232
$this->logRef = $logRef;

src/Http/RestClientBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ protected function getRetryDecider(): callable
126126
return function (
127127
$retries,
128128
Request $request,
129-
Response $response = null,
130-
GuzzleException $exception = null
129+
?Response $response = null,
130+
?GuzzleException $exception = null
131131
) {
132132
// Don't retry unless this is a Connection issue
133133
if (!$exception instanceof ConnectException) {

src/Mailboxes/Mailbox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getCreatedAt()
9999
/**
100100
* @return Mailbox
101101
*/
102-
public function setCreatedAt(DateTime $createdAt = null): self
102+
public function setCreatedAt(?DateTime $createdAt = null): self
103103
{
104104
$this->createdAt = $createdAt;
105105

@@ -117,7 +117,7 @@ public function getUpdatedAt()
117117
/**
118118
* @return Mailbox
119119
*/
120-
public function setUpdatedAt(DateTime $updatedAt = null): self
120+
public function setUpdatedAt(?DateTime $updatedAt = null): self
121121
{
122122
$this->updatedAt = $updatedAt;
123123

src/Mailboxes/MailboxesEndpoint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MailboxesEndpoint extends Endpoint
1515
public const LIST_MAILBOXES_URI = '/v2/mailboxes';
1616
public const RESOURCE_KEY = 'mailboxes';
1717

18-
public function get(int $id, MailboxRequest $mailboxRequest = null): Mailbox
18+
public function get(int $id, ?MailboxRequest $mailboxRequest = null): Mailbox
1919
{
2020
$mailboxResource = $this->restClient->getResource(
2121
Mailbox::class,
@@ -30,7 +30,7 @@ public function get(int $id, MailboxRequest $mailboxRequest = null): Mailbox
3030
/**
3131
* @return Mailbox[]|PagedCollection
3232
*/
33-
public function list(MailboxRequest $mailboxRequest = null): PagedCollection
33+
public function list(?MailboxRequest $mailboxRequest = null): PagedCollection
3434
{
3535
return $this->loadMailboxes(
3636
self::LIST_MAILBOXES_URI,

0 commit comments

Comments
 (0)