Skip to content

Commit

Permalink
Fix Query::count()
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Nov 15, 2023
1 parent 4629a8c commit b27a71c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b27a71c

Please sign in to comment.