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

[PHP 8.4] Fixes for implicit nullability deprecation #722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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/PhpImap/Exceptions/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class ConnectionException extends Exception
{
public function __construct(array $message, int $code = 0, Exception $previous = null)
public function __construct(array $message, int $code = 0, ?Exception $previous = null)
{
parent::__construct(json_encode($message), $code, $previous);
}
Expand Down
10 changes: 5 additions & 5 deletions src/PhpImap/Imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public static function append(
$imap_stream,
string $mailbox,
string $message,
string $options = null,
string $internal_date = null
?string $options = null,
?string $internal_date = null
): bool {
\imap_errors(); // flush errors

Expand Down Expand Up @@ -816,7 +816,7 @@ public static function search(
$imap_stream,
string $criteria,
int $options = SE_FREE,
string $charset = null,
?string $charset = null,
bool $encodeCriteriaAsUtf7Imap = false
): array {
\imap_errors(); // flush errors
Expand Down Expand Up @@ -906,8 +906,8 @@ public static function sort(
int $criteria,
bool $reverse,
int $options,
string $search_criteria = null,
string $charset = null
?string $search_criteria = null,
?string $charset = null
): array {
\imap_errors(); // flush errors

Expand Down
10 changes: 5 additions & 5 deletions src/PhpImap/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Mailbox
/**
* @throws InvalidParameterException
*/
public function __construct(string $imapPath, string $login, string $password, string $attachmentsDir = null, string $serverEncoding = 'UTF-8', bool $trimImapPath = true, bool $attachmentFilenameMode = false)
public function __construct(string $imapPath, string $login, string $password, ?string $attachmentsDir = null, string $serverEncoding = 'UTF-8', bool $trimImapPath = true, bool $attachmentFilenameMode = false)
{
$this->imapPath = (true == $trimImapPath) ? \trim($imapPath) : $imapPath;
$this->imapLogin = \trim($login);
Expand Down Expand Up @@ -380,7 +380,7 @@ public function getLogin(): string
*
* @throws InvalidParameterException
*/
public function setConnectionArgs(int $options = 0, int $retriesNum = 0, array $params = null): void
public function setConnectionArgs(int $options = 0, int $retriesNum = 0, ?array $params = null): void
{
if (0 !== $options) {
if (($options & self::IMAP_OPTIONS_SUPPORTED_VALUES) !== $options) {
Expand Down Expand Up @@ -1020,7 +1020,7 @@ public function sortMails(
int $criteria = SORTARRIVAL,
bool $reverse = true,
?string $searchCriteria = 'ALL',
string $charset = null
?string $charset = null
): array {
return Imap::sort(
$this->getImapStream(),
Expand Down Expand Up @@ -1634,8 +1634,8 @@ public function unsubscribeMailbox(string $mailbox): void
public function appendMessageToMailbox(
$message,
string $mailbox = '',
string $options = null,
string $internal_date = null
?string $options = null,
?string $internal_date = null
): bool {
if (
\is_array($message) &&
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Fixtures/DataPartInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function fetch(): string
return $this->decodeAfterFetch($this->data);
}

public function setData(string $data = null): void
public function setData(?string $data = null): void
{
$this->data = $data;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/MailboxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ public function connectionArgsProvider(): Generator
*
* @psalm-param array{DISABLE_AUTHENTICATOR?:string}|array<empty, empty> $param
*/
public function testSetConnectionArgs(string $assertMethod, int $option, int $retriesNum, array $param = null): void
public function testSetConnectionArgs(string $assertMethod, int $option, int $retriesNum, ?array $param = null): void
{
$mailbox = $this->getMailbox();

Expand Down