Skip to content

Commit

Permalink
BUG: An argument $reverse of method \PhpImap\Imap::sort() has type bo…
Browse files Browse the repository at this point in the history
…olean from PHP version 8 only (#659)

BUG: And argument $reverse of method \PhpImap\Imap::sort() has type boolean from PHP version 8 only
  • Loading branch information
alebedev80 committed Feb 17, 2022
1 parent ce19d61 commit f1e316b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/PhpImap/Imap.php
Expand Up @@ -14,6 +14,7 @@
use const IMAP_WRITETIMEOUT;
use InvalidArgumentException;
use const NIL;
use const PHP_MAJOR_VERSION;
use PhpImap\Exceptions\ConnectionException;
use const SE_FREE;
use const SORTARRIVAL;
Expand Down Expand Up @@ -911,11 +912,18 @@ public static function sort(
\imap_errors(); // flush errors

$imap_stream = self::EnsureConnection($imap_stream, __METHOD__, 1);
$reverse = $reverse;

/** @var int */
$criteria = $criteria;

if (PHP_MAJOR_VERSION < 8) {
/** @var int */
$reverse = (int) $reverse;
} else {
/** @var bool */
$reverse = $reverse;
}

if (null !== $search_criteria && null !== $charset) {
$result = \imap_sort(
$imap_stream,
Expand Down

0 comments on commit f1e316b

Please sign in to comment.