From 314077a457f04cc2f0472e036af029e2676fbf02 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 15 Jan 2024 10:36:30 +0100 Subject: PHPStan prepare exceptions (#6037) Take advantage of https://phpstan.org/blog/bring-your-exceptions-under-control Minimum changes to pass `tooWideThrowType` and `implicitThrows`. Revert some mistakes from: https://github.com/FreshRSS/FreshRSS/pull/5504 Preparation needed before new PRs of the same type: https://github.com/FreshRSS/FreshRSS/pull/5962 Fix several wrong PHPDocs and catches: > Method ... has ...Exception in PHPDoc @throws tag but it's not thrown. > Dead catch - ...Exception is never thrown in the try block. --- app/Models/EntryDAO.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/Models/EntryDAO.php') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index b809c7475..abcc33a1a 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1007,6 +1007,7 @@ SQL; /** * @param 'ASC'|'DESC' $order * @return array{0:array,1:string} + * @throws FreshRSS_EntriesGetter_Exception */ protected function sqlListEntriesWhere(string $alias = '', ?FreshRSS_BooleanSearch $filters = null, int $state = FreshRSS_Entry::STATE_ALL, @@ -1059,6 +1060,7 @@ SQL; * @param int $id category/feed/tag ID * @param 'ASC'|'DESC' $order * @return array{0:array,1:string} + * @throws FreshRSS_EntriesGetter_Exception */ private function sqlListWhere(string $type = 'a', int $id = 0, int $state = FreshRSS_Entry::STATE_ALL, string $order = 'DESC', int $limit = 1, string $firstId = '', ?FreshRSS_BooleanSearch $filters = null, @@ -1126,6 +1128,7 @@ SQL; * @param 'ASC'|'DESC' $order * @param int $id category/feed/tag ID * @return PDOStatement|false + * @throws FreshRSS_EntriesGetter_Exception */ private function listWhereRaw(string $type = 'a', int $id = 0, int $state = FreshRSS_Entry::STATE_ALL, string $order = 'DESC', int $limit = 1, string $firstId = '', ?FreshRSS_BooleanSearch $filters = null, @@ -1161,6 +1164,7 @@ SQL; * @param int $id category/feed/tag ID * @param 'ASC'|'DESC' $order * @return Traversable + * @throws FreshRSS_EntriesGetter_Exception */ public function listWhere(string $type = 'a', int $id = 0, int $state = FreshRSS_Entry::STATE_ALL, string $order = 'DESC', int $limit = 1, string $firstId = '', @@ -1226,6 +1230,7 @@ SQL; * @param int $id category/feed/tag ID * @param 'ASC'|'DESC' $order * @return array|null + * @throws FreshRSS_EntriesGetter_Exception */ public function listIdsWhere(string $type = 'a', int $id = 0, int $state = FreshRSS_Entry::STATE_ALL, string $order = 'DESC', int $limit = 1, string $firstId = '', ?FreshRSS_BooleanSearch $filters = null): ?array { -- cgit v1.2.3