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/Models/Context.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'app/Models/Context.php') diff --git a/app/Models/Context.php b/app/Models/Context.php index 6b2043bd3..62dc53774 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -5,8 +5,17 @@ * useful functions associated to the current view state. */ class FreshRSS_Context { + + /** + * @var FreshRSS_UserConfiguration|null + */ public static $user_conf = null; + + /** + * @var FreshRSS_SystemConfiguration|null + */ public static $system_conf = null; + public static $categories = array(); public static $tags = array(); @@ -49,7 +58,11 @@ class FreshRSS_Context { if ($reload || FreshRSS_Context::$system_conf == null) { //TODO: Keep in session what we need instead of always reloading from disk Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); - FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); + /** + * @var FreshRSS_SystemConfiguration $system_conf + */ + $system_conf = Minz_Configuration::get('system'); + FreshRSS_Context::$system_conf = $system_conf; // Register the configuration setter for the system configuration $configurationSetter = new FreshRSS_ConfigurationSetter(); FreshRSS_Context::$system_conf->_configurationSetter($configurationSetter); @@ -80,7 +93,11 @@ class FreshRSS_Context { FreshRSS_Context::$system_conf->configurationSetter()); Minz_Session::_param('currentUser', $username); - FreshRSS_Context::$user_conf = Minz_Configuration::get('user'); + /** + * @var FreshRSS_UserConfiguration $user_conf + */ + $user_conf = Minz_Configuration::get('user'); + FreshRSS_Context::$user_conf = $user_conf; } catch (Exception $ex) { Minz_Log::warning($ex->getMessage(), USERS_PATH . '/_/log.txt'); } -- cgit v1.2.3