Chore: findOne now returns empty documents instead of false on miss

This commit is contained in:
Bradley Schofield authored and Matej Bačo committed 2024-12-12 19:35:49 +00:00
1 parent e404c21e8d
commit 27cd99bac0
1 file changed
+2 -2
+2 -2
View File
@@ -175,7 +175,7 @@ class TimeLimit extends TimeLimitAdapter
Query::equal('time', [$datetime]),
]);
if ($data === false) {
if ($data->isEmpty()) {
$data = [
'$permissions' => [],
'key' => $key,
@@ -193,7 +193,7 @@ class TimeLimit extends TimeLimitAdapter
Query::equal('time', [$datetime]),
]);
if ($data !== false && $data instanceof Document) {
if (!$data->isEmpty()) {
$count = $data->getAttribute('count', 0);
if (\is_numeric($count)) {
$this->count = intval($count);