From 1335a0e3cf11a0d4248e9eaaf748b89e6df741ef Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 4 Jan 2022 13:59:09 +0100 Subject: PHPStan level 5 (#4110) * Fix most PHPDocs errors Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103 https://phpstan.org/writing-php-code/phpdoc-types * Avoid func_get_args Use variadic syntax instead https://php.net/manual/functions.arguments#functions.variable-arg-list And avoid dynamic functions names when possible to more easily identify calls and unused functions. Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103 * PHPStan level 3 * PHPStand level 4 * Update default to PHPStan level 4 * Towards level 5 * Fix level 4 regression * Towards level 5 * Pass PHPStan level 5 * Towards level 6 * Remove erronenous regression from changelog https://github.com/FreshRSS/FreshRSS/pull/4116 --- app/Controllers/configureController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/Controllers/configureController.php') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index b8bf97e77..a263db99c 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -3,7 +3,7 @@ /** * Controller to handle every configuration options. */ -class FreshRSS_configure_Controller extends Minz_ActionController { +class FreshRSS_configure_Controller extends FreshRSS_ActionController { /** * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the @@ -249,7 +249,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $volatile = [ 'enable_keep_period' => true, 'keep_period_count' => $matches['count'], - 'keep_period_unit' => str_replace($matches['count'], 1, $keepPeriod), + 'keep_period_unit' => str_replace($matches['count'], '1', $keepPeriod), ]; } FreshRSS_Context::$user_conf->volatile = $volatile; @@ -295,7 +295,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { if ($query['search']) { $query['search'] = urldecode($query['search']); } - $queries[] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao); + $queries[intval($key)] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao); } FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); @@ -304,7 +304,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { } else { $this->view->queries = array(); foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { - $this->view->queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao); + $this->view->queries[intval($key)] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao); } } @@ -315,6 +315,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $id = Minz_Request::param('id'); $this->view->displaySlider = false; if (false !== $id) { + $id = intval($id); $this->view->displaySlider = true; $this->view->query = $this->view->queries[$id]; $this->view->queryId = $id; -- cgit v1.2.3