Skip to content

Commit

Permalink
Fix "implicit nulls" deprecation warnings for PHP 8.4 (#328)
Browse files Browse the repository at this point in the history
Co-authored-by: Miguel Rosales Sueiro <[email protected]>
  • Loading branch information
matical and miguelrs authored Jan 9, 2025
1 parent cd377dd commit 52078c2
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/Conversations/ConversationsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

Expand Down Expand Up @@ -96,8 +96,8 @@ public function updateTags(int $conversationId, $tags): void
* @return Conversation[]|PagedCollection
*/
public function list(
ConversationFilters $conversationFilters = null,
ConversationRequest $conversationRequest = null
?ConversationFilters $conversationFilters = null,
?ConversationRequest $conversationRequest = null
): PagedCollection {
$uri = '/v2/conversations';
if ($conversationFilters) {
Expand Down
2 changes: 1 addition & 1 deletion src/Conversations/CustomerWaitingSince.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function extract(): array
return $fields;
}

public function setTime(DateTime $time = null): self
public function setTime(?DateTime $time = null): self
{
$this->time = $time;

Expand Down
16 changes: 6 additions & 10 deletions src/Customers/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function getCreatedAt(): ?DateTime
return $this->createdAt;
}

public function setCreatedAt(DateTime $createdAt = null): Customer
public function setCreatedAt(?DateTime $createdAt = null): Customer
{
$this->createdAt = $createdAt;

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

public function setUpdatedAt(DateTime $updatedAt = null): Customer
public function setUpdatedAt(?DateTime $updatedAt = null): Customer
{
$this->updatedAt = $updatedAt;

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

/**
* @param ChatHandle|string $chat
* @param string $type
*/
public function addChatHandle($chat, string $type = null): Customer
public function addChatHandle($chat, ?string $type = null): Customer
{
if (is_string($chat)) {
$newChatHandle = new ChatHandle();
Expand Down Expand Up @@ -480,9 +479,8 @@ public function setEmails(Collection $emails): Customer

/**
* @param Email|string $email
* @param string $type
*/
public function addEmail($email, string $type = null): Customer
public function addEmail($email, ?string $type = null): Customer
{
if (is_string($email)) {
$newEmail = new Email();
Expand Down Expand Up @@ -528,9 +526,8 @@ public function setPhones(Collection $phones): Customer

/**
* @param Phone|string $phone
* @param string $type
*/
public function addPhone($phone, string $type = null): Customer
public function addPhone($phone, ?string $type = null): Customer
{
if (is_string($phone)) {
$newPhone = new Phone();
Expand Down Expand Up @@ -566,9 +563,8 @@ public function setSocialProfiles(Collection $socialProfiles): Customer

/**
* @param SocialProfile|string $profile
* @param string $type
*/
public function addSocialProfile($profile, string $type = null): Customer
public function addSocialProfile($profile, ?string $type = null): Customer
{
if (is_string($profile)) {
$newProfile = new SocialProfile();
Expand Down
6 changes: 3 additions & 3 deletions src/Customers/CustomersEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function update(Customer $customer): void
);
}

public function get(int $id, CustomerRequest $customerRequest = null): Customer
public function get(int $id, ?CustomerRequest $customerRequest = null): Customer
{
$customerResource = $this->restClient->getResource(
Customer::class,
Expand All @@ -51,8 +51,8 @@ public function get(int $id, CustomerRequest $customerRequest = null): Customer
* @return Customer[]|PagedCollection
*/
public function list(
CustomerFilters $customerFilters = null,
CustomerRequest $customerRequest = null
?CustomerFilters $customerFilters = null,
?CustomerRequest $customerRequest = null
): PagedCollection {
$uri = '/v2/customers';
if ($customerFilters) {
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ValidationErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
VndError $error,
RequestInterface $request,
ResponseInterface $response,
\Exception $previous = null
?\Exception $previous = null
) {
// Append some details on what steps to take to see the underlying validation problems are.
$message = $message.' - use getError() to see the underlying validation issues';
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Authenticator
*/
private $tokenRefreshedCallback;

public function __construct(Client $client, Auth $auth = null)
public function __construct(Client $client, ?Auth $auth = null)
{
$this->client = $client;
$this->auth = $auth ?? new NullCredentials();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Hal/VndError.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class VndError
*/
private $errors = [];

public function __construct(string $message, string $logRef = null, string $path = null)
public function __construct(string $message, ?string $logRef = null, ?string $path = null)
{
$this->message = $message;
$this->logRef = $logRef;
Expand Down
4 changes: 2 additions & 2 deletions src/Http/RestClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ protected function getRetryDecider(): callable
return function (
$retries,
Request $request,
Response $response = null,
GuzzleException $exception = null
?Response $response = null,
?GuzzleException $exception = null
) {
// Don't retry unless this is a Connection issue
if (!$exception instanceof ConnectException) {
Expand Down
4 changes: 2 additions & 2 deletions src/Mailboxes/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getCreatedAt()
/**
* @return Mailbox
*/
public function setCreatedAt(DateTime $createdAt = null): self
public function setCreatedAt(?DateTime $createdAt = null): self
{
$this->createdAt = $createdAt;

Expand All @@ -117,7 +117,7 @@ public function getUpdatedAt()
/**
* @return Mailbox
*/
public function setUpdatedAt(DateTime $updatedAt = null): self
public function setUpdatedAt(?DateTime $updatedAt = null): self
{
$this->updatedAt = $updatedAt;

Expand Down
4 changes: 2 additions & 2 deletions src/Mailboxes/MailboxesEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MailboxesEndpoint extends Endpoint
public const LIST_MAILBOXES_URI = '/v2/mailboxes';
public const RESOURCE_KEY = 'mailboxes';

public function get(int $id, MailboxRequest $mailboxRequest = null): Mailbox
public function get(int $id, ?MailboxRequest $mailboxRequest = null): Mailbox
{
$mailboxResource = $this->restClient->getResource(
Mailbox::class,
Expand All @@ -30,7 +30,7 @@ public function get(int $id, MailboxRequest $mailboxRequest = null): Mailbox
/**
* @return Mailbox[]|PagedCollection
*/
public function list(MailboxRequest $mailboxRequest = null): PagedCollection
public function list(?MailboxRequest $mailboxRequest = null): PagedCollection
{
return $this->loadMailboxes(
self::LIST_MAILBOXES_URI,
Expand Down
4 changes: 2 additions & 2 deletions src/Teams/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function getCreatedAt(): ?DateTime
return $this->createdAt;
}

public function setCreatedAt(DateTime $createdAt = null): Team
public function setCreatedAt(?DateTime $createdAt = null): Team
{
$this->createdAt = $createdAt;

Expand All @@ -171,7 +171,7 @@ public function getUpdatedAt(): ?DateTime
return $this->updatedAt;
}

public function setUpdatedAt(DateTime $updatedAt = null): Team
public function setUpdatedAt(?DateTime $updatedAt = null): Team
{
$this->updatedAt = $updatedAt;

Expand Down
4 changes: 2 additions & 2 deletions src/Users/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getCreatedAt(): ?DateTime
return $this->createdAt;
}

public function setCreatedAt(DateTime $createdAt = null): User
public function setCreatedAt(?DateTime $createdAt = null): User
{
$this->createdAt = $createdAt;

Expand All @@ -153,7 +153,7 @@ public function getUpdatedAt(): ?DateTime
return $this->updatedAt;
}

public function setUpdatedAt(DateTime $updatedAt = null): User
public function setUpdatedAt(?DateTime $updatedAt = null): User
{
$this->updatedAt = $updatedAt;

Expand Down
2 changes: 1 addition & 1 deletion src/Users/UsersEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getAuthenticatedUser(): User
* @return User[]|PagedCollection
*/
public function list(
UserFilters $userFilters = null
?UserFilters $userFilters = null
): PagedCollection {
$uri = self::LIST_USERS_URI;
if ($userFilters) {
Expand Down

0 comments on commit 52078c2

Please sign in to comment.