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 --- p/api/fever.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'p/api/fever.php') diff --git a/p/api/fever.php b/p/api/fever.php index 26efe841b..fde4ba7f5 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -113,7 +113,7 @@ final class FeverDAO extends Minz_ModelPdo $sql .= ' LIMIT 50'; $stm = $this->pdo->prepare($sql); - if ($stm && $stm->execute($values)) { + if ($stm !== false && $stm->execute($values)) { $result = $stm->fetchAll(PDO::FETCH_ASSOC); $entries = array(); @@ -374,10 +374,7 @@ final class FeverAPI return $favicons; } - /** - * @return int|false - */ - private function getTotalItems() { + private function getTotalItems(): int { return $this->entryDAO->count(); } @@ -419,12 +416,12 @@ final class FeverAPI } private function getUnreadItemIds(): string { - $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_NOT_READ, 'ASC', 0) ?: []; + $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_NOT_READ, 'ASC', 0) ?? []; return $this->entriesToIdList($entries); } private function getSavedItemIds(): string { - $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0) ?: []; + $entries = $this->entryDAO->listIdsWhere('a', 0, FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0) ?? []; return $this->entriesToIdList($entries); } -- cgit v1.2.3