Skip to content

Commit f1e316b

Browse files
authored
BUG: An argument $reverse of method \PhpImap\Imap::sort() has type boolean from PHP version 8 only (#659)
BUG: And argument $reverse of method \PhpImap\Imap::sort() has type boolean from PHP version 8 only
1 parent ce19d61 commit f1e316b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/PhpImap/Imap.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use const IMAP_WRITETIMEOUT;
1515
use InvalidArgumentException;
1616
use const NIL;
17+
use const PHP_MAJOR_VERSION;
1718
use PhpImap\Exceptions\ConnectionException;
1819
use const SE_FREE;
1920
use const SORTARRIVAL;
@@ -911,11 +912,18 @@ public static function sort(
911912
\imap_errors(); // flush errors
912913

913914
$imap_stream = self::EnsureConnection($imap_stream, __METHOD__, 1);
914-
$reverse = $reverse;
915915

916916
/** @var int */
917917
$criteria = $criteria;
918918

919+
if (PHP_MAJOR_VERSION < 8) {
920+
/** @var int */
921+
$reverse = (int) $reverse;
922+
} else {
923+
/** @var bool */
924+
$reverse = $reverse;
925+
}
926+
919927
if (null !== $search_criteria && null !== $charset) {
920928
$result = \imap_sort(
921929
$imap_stream,

0 commit comments

Comments
 (0)