Skip to content

Commit 42e8856

Browse files
committed
refactor: Melhora a verificação de conexão com o banco de dados na classe CycleHealthCheck
1 parent 605fe7a commit 42e8856

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Health/CycleHealthCheck.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ private static function checkDatabase(object $app): array
174174
if (is_object($db) && method_exists($db, 'execute')) {
175175
// Tenta executar um SELECT 1
176176
$result = $db->execute('SELECT 1');
177-
$hasDatabase = ($result !== false);
177+
$hasDatabase = (false !== $result);
178178
} elseif (is_object($db) && method_exists($db, 'getPDO')) {
179179
// Fallback: tenta usar PDO diretamente
180180
$pdo = $db->getPDO();
181181
$stmt = $pdo->query('SELECT 1');
182-
$hasDatabase = ($stmt !== false);
182+
$hasDatabase = (false !== $stmt);
183183
} else {
184184
$hasDatabase = false;
185185
$error = 'Método execute/getPDO não disponível na conexão.';
@@ -196,6 +196,7 @@ private static function checkDatabase(object $app): array
196196
if ($error) {
197197
$status['error'] = $error;
198198
}
199+
199200
return $status;
200201
}
201202

0 commit comments

Comments
 (0)