From c72914bba2363e436574204b3d6093a6f3cfce89 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 28 Apr 2023 14:01:11 +0200 Subject: PHPStan Level 7 for more DAO PDO (#5328) * PHPStan Level 7 for more DAO PDO With new function to address common type and check problems * A bit more * PHPStan Level 7 for FreshRSS_Entry --- app/Models/StatsDAOPGSQL.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/Models/StatsDAOPGSQL.php') diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php index 52a99d2f4..6e0e04c60 100644 --- a/app/Models/StatsDAOPGSQL.php +++ b/app/Models/StatsDAOPGSQL.php @@ -47,11 +47,10 @@ GROUP BY period ORDER BY period ASC SQL; - $stm = $this->pdo->query($sql); - if ($stm === false) { + $res = $this->fetchAssoc($sql); + if ($res == null) { return []; } - $res = $stm->fetchAll(PDO::FETCH_NAMED); switch ($period) { case 'hour': @@ -69,7 +68,7 @@ SQL; $repartition = array_fill(0, $periodMax, 0); foreach ($res as $value) { - $repartition[(int) $value['period']] = (int) $value['count']; + $repartition[(int)$value['period']] = (int)$value['count']; } return $repartition; -- cgit v1.2.3