diff --git a/src/PhpImap/Exceptions/ConnectionException.php b/src/PhpImap/Exceptions/ConnectionException.php index fb644978..b56b3872 100644 --- a/src/PhpImap/Exceptions/ConnectionException.php +++ b/src/PhpImap/Exceptions/ConnectionException.php @@ -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); } diff --git a/src/PhpImap/Imap.php b/src/PhpImap/Imap.php index 655c1dc8..bafb1037 100644 --- a/src/PhpImap/Imap.php +++ b/src/PhpImap/Imap.php @@ -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 @@ -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 @@ -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 diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 02a3dad9..c7f79aa7 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -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); @@ -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) { @@ -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(), @@ -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) && diff --git a/tests/unit/Fixtures/DataPartInfo.php b/tests/unit/Fixtures/DataPartInfo.php index 7f012827..dc8e134d 100644 --- a/tests/unit/Fixtures/DataPartInfo.php +++ b/tests/unit/Fixtures/DataPartInfo.php @@ -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; } diff --git a/tests/unit/MailboxTest.php b/tests/unit/MailboxTest.php index 507ff596..e441348b 100644 --- a/tests/unit/MailboxTest.php +++ b/tests/unit/MailboxTest.php @@ -678,7 +678,7 @@ public function connectionArgsProvider(): Generator * * @psalm-param array{DISABLE_AUTHENTICATOR?:string}|array $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();