From b27a71c0cbdfab8a2a503dbad76b354367213198 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 15 Nov 2023 12:21:26 +0700 Subject: [PATCH] Fix `Query::count()` --- src/Query/Query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Query/Query.php b/src/Query/Query.php index 98e69b962..4525f0189 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -293,10 +293,10 @@ public function column(): array public function count(string $sql = '*'): int|string { - return match ($this->emulateExecution) { - true => 0, - false => is_numeric($count = $this->queryScalar("COUNT($sql)")) ? (int) $count : 0, - }; + /** @var int|string|null $count */ + $count = $this->queryScalar("COUNT($sql)"); + /** @var int|string */ + return $count <= PHP_INT_MAX ? (int) $count : $count; } public function createCommand(): CommandInterface