Skip to content

Commit 4a5cedc

Browse files
authored
Merge pull request #52 from vc-dhavaljoshi/main
#48 resolve issue getTableSize(): Return value must be of type string
2 parents 997ea50 + daa3236 commit 4a5cedc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Constants/Constant.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,6 @@ class Constant
110110
public const ACTION = 'action';
111111

112112
public const STATUS = 'status';
113+
114+
public const DEFAULT_SIZE = '0.00';
113115
}

src/Traits/DBConnection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ public function getTableSize(string $tableName): string
103103
ORDER BY
104104
(DATA_LENGTH + INDEX_LENGTH) DESC';
105105
$result = DB::select($query);
106+
106107
if ($result) {
107-
return $result[0]->size;
108+
return $result[0]->size ?? Constant::DEFAULT_SIZE;
108109
}
109110

110111
} catch (Exception $exception) {
111112
Log::error($exception->getMessage());
112113
}
113-
return Constant::NULL;
114+
return Constant::DEFAULT_SIZE;
114115
}
115116

116117
/**

0 commit comments

Comments
 (0)