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/Controllers/categoryController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/Controllers/categoryController.php') diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 0ca1bbbcd..60685c566 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -79,6 +79,8 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController { /** * This action updates the given category. + * @todo Check whether this function is used at all + * @see FreshRSS_subscription_Controller::categoryAction() (consider merging) * * Request parameters are: * - id @@ -97,14 +99,16 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController { Minz_Request::bad(_t('feedback.sub.category.no_name'), $url_redirect); } - if ($catDAO->searchById($id) == null) { + $cat = $catDAO->searchById($id); + if ($cat === null) { Minz_Request::bad(_t('feedback.sub.category.not_exist'), $url_redirect); } - $cat = new FreshRSS_Category($name); - $values = array( + $values = [ 'name' => $cat->name(), - ); + 'kind' => $cat->kind(), + 'attributes' => $cat->attributes(), + ]; if ($catDAO->updateCategory($id, $values)) { Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect); -- cgit v1.2.3