Skip to content

Commit

Permalink
Obviously check if $count is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Nov 15, 2023
1 parent b27a71c commit 1d82491
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ public function count(string $sql = '*'): int|string
{
/** @var int|string|null $count */
$count = $this->queryScalar("COUNT($sql)");
/** @var int|string */

if ($count === null) {
return 0;
}

return $count <= PHP_INT_MAX ? (int) $count : $count;

Check warning on line 303 in src/Query/Query.php

View check run for this annotation

Codecov / codecov/patch

src/Query/Query.php#L303

Added line #L303 was not covered by tests
}

Expand Down

0 comments on commit 1d82491

Please sign in to comment.