A free, self-hostable news aggregator…
Fix most PHPDocs errors (#4107)
Alexandre Alapetite3f6aa42b8171
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.phpindex 1f64687de..e95bd8763 100755--- a/app/Controllers/feedController.php+++ b/app/Controllers/feedController.php@@ -27,7 +27,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {}/**- * @param $url+ * @param string $url* @param string $title* @param int $cat_id* @param string $new_cat_name@@ -46,7 +46,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {$url = trim($url);- /** @var $url */+ /** @var string $url */$url = Minz_ExtensionManager::callHook('check_url_before_add', $url);if (null === $url) {throw new FreshRSS_FeedNotAdded_Exception($url, $title);diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.phpindex 535f17e2e..3c07db4a0 100644--- a/app/Models/ConfigurationSetter.php+++ b/app/Models/ConfigurationSetter.php@@ -3,8 +3,8 @@class FreshRSS_ConfigurationSetter {/*** Return if the given key is supported by this setter.- * @param $key the key to test.- * @return boolean true if the key is supported, false else.+ * @param string $key the key to test.+ * @return boolean true if the key is supported, false otherwise.*/public function support($key) {$name_setter = '_' . $key;@@ -13,9 +13,9 @@ class FreshRSS_ConfigurationSetter {/*** Set the given key in data with the current value.- * @param $data an array containing the list of all configuration data.- * @param $key the key to update.- * @param $value the value to set.+ * @param array $data an array containing the list of all configuration data.+ * @param string $key the key to update.+ * @param mixed $value the value to set.*/public function handle(&$data, $key, $value) {$name_setter = '_' . $key;@@ -25,7 +25,7 @@ class FreshRSS_ConfigurationSetter {/*** A helper to set boolean values.*- * @param $value the tested value.+ * @param mixed $value the tested value.* @return boolean true if value is true and different from no, false else.*/private function handleBool($value) {diff --git a/app/Models/Context.php b/app/Models/Context.phpindex 14bca866c..6b2043bd3 100644--- a/app/Models/Context.php+++ b/app/Models/Context.php@@ -125,6 +125,7 @@ class FreshRSS_Context {/*** Returns if the current state includes $state parameter.+ * @param int $state*/public static function isStateEnabled($state) {return self::$state & $state;@@ -132,6 +133,7 @@ class FreshRSS_Context {/*** Returns the current state with or without $state parameter.+ * @param int $state*/public static function getRevertState($state) {if (self::$state & $state) {diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex 7b7f5f53e..2e4f52d0b 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -546,7 +546,7 @@ SQL;* @param integer $idMax max article ID* @return integer affected rows*/- public function markReadTag($id = '', $idMax = 0, $filters = null, $state = 0, $is_read = true) {+ public function markReadTag($id = 0, $idMax = 0, $filters = null, $state = 0, $is_read = true) {FreshRSS_UserDAO::touch();if ($idMax == 0) {$idMax = time() . '000000';@@ -556,10 +556,10 @@ SQL;$sql = 'UPDATE `_entry` e INNER JOIN `_entrytag` et ON et.id_entry = e.id '. 'SET e.is_read = ? '. 'WHERE '- . ($id == '' ? '' : 'et.id_tag = ? AND ')+ . ($id == 0 ? '' : 'et.id_tag = ? AND '). 'e.is_read <> ? AND e.id <= ?';$values = array($is_read ? 1 : 0);- if ($id != '') {+ if ($id != 0) {$values[] = $id;}$values[] = $is_read ? 1 : 0;diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.phpindex f0b9a318b..65df483ff 100644--- a/app/Models/EntryDAOSQLite.php+++ b/app/Models/EntryDAOSQLite.php@@ -246,7 +246,7 @@ DROP TABLE IF EXISTS `tmp`;* @param integer $idMax max article ID* @return integer affected rows*/- public function markReadTag($id = '', $idMax = 0, $filters = null, $state = 0, $is_read = true) {+ public function markReadTag($id = 0, $idMax = 0, $filters = null, $state = 0, $is_read = true) {FreshRSS_UserDAO::touch();if ($idMax == 0) {$idMax = time() . '000000';@@ -257,10 +257,10 @@ DROP TABLE IF EXISTS `tmp`;. 'SET is_read = ? '. 'WHERE is_read <> ? AND id <= ? AND '. 'id IN (SELECT et.id_entry FROM `_entrytag` et '- . ($id == '' ? '' : 'WHERE et.id_tag = ?')+ . ($id == 0 ? '' : 'WHERE et.id_tag = ?'). ')';$values = array($is_read ? 1 : 0, $is_read ? 1 : 0, $idMax);- if ($id != '') {+ if ($id != 0) {$values[] = $id;}diff --git a/app/Models/Share.php b/app/Models/Share.phpindex f536418fc..695b16eca 100644--- a/app/Models/Share.php+++ b/app/Models/Share.php@@ -11,7 +11,7 @@ class FreshRSS_Share {/*** Register a new sharing option.- * @param $share_options is an array defining the share option.+ * @param array<string,string> $share_options is an array defining the share option.*/public static function register($share_options) {$type = $share_options['type'];@@ -31,7 +31,7 @@ class FreshRSS_Share {/*** Register sharing options in a file.- * @param $filename the name of the file to load.+ * @param string $filename the name of the file to load.*/public static function load($filename) {$shares_from_file = @include($filename);@@ -51,7 +51,7 @@ class FreshRSS_Share {/*** Return the list of sharing options.- * @return array[FreshRSS_Share]+ * @return array<FreshRSS_Share>*/public static function enum() {return self::$list_sharing;@@ -59,7 +59,7 @@ class FreshRSS_Share {/*** Return FreshRSS_Share object related to the given type.- * @param $type the share type, null if $type is not registered.+ * @param string $type the share type, null if $type is not registered.*/public static function get($type) {if (!isset(self::$list_sharing[$type])) {@@ -88,14 +88,14 @@ class FreshRSS_Share {/*** Create a FreshRSS_Share object.- * @param $type is a unique string defining the kind of share option.- * @param $url_transform defines the url format to use in order to share.- * @param $transform is an array of transformations to apply on link and title.- * @param $form_type defines which form we have to use to complete. "simple"+ * @param string $type is a unique string defining the kind of share option.+ * @param string $url_transform defines the url format to use in order to share.+ * @param array<string> $transform is an array of transformations to apply on link and title.+ * @param string $form_type defines which form we have to use to complete. "simple"* is typically for a centralized service while "advanced" is for* decentralized ones.- * @param $help_url is an optional url to give help on this option.- * @param $method defines the sharing method (GET or POST)+ * @param string $help_url is an optional url to give help on this option.+ * @param string $method defines the sharing method (GET or POST)*/private function __construct($type, $url_transform, $transform, $form_type, $help_url, $method, $field) {$this->type = $type;@@ -121,7 +121,7 @@ class FreshRSS_Share {/*** Update a FreshRSS_Share object with information from an array.- * @param $options is a list of informations to update where keys should be+ * @param array<string,string> $options is a list of informations to update where keys should be* in this list: name, url, id, title, link.*/public function update($options) {@@ -217,7 +217,7 @@ class FreshRSS_Share {/*** Return the id.- * @param $raw true if we should get the id without transformations.+ * @param bool $raw true if we should get the id without transformations.*/public function id($raw = false) {if ($raw) {@@ -229,7 +229,7 @@ class FreshRSS_Share {/*** Return the title.- * @param $raw true if we should get the title without transformations.+ * @param bool $raw true if we should get the title without transformations.*/public function title($raw = false) {if ($raw) {@@ -241,7 +241,7 @@ class FreshRSS_Share {/*** Return the link.- * @param $raw true if we should get the link without transformations.+ * @param bool $raw true if we should get the link without transformations.*/public function link($raw = false) {if ($raw) {@@ -253,8 +253,8 @@ class FreshRSS_Share {/*** Transform a data with the given functions.- * @param $data the data to transform.- * @param $tranform an array containing a list of functions to apply.+ * @param string $data the data to transform.+ * @param array<string> $transform an array containing a list of functions to apply.* @return mixed the transformed data.*/private static function transform($data, $transform) {@@ -273,8 +273,8 @@ class FreshRSS_Share {/*** Get the list of transformations for the given attribute.- * @param $attr the attribute of which we want the transformations.- * @return an array containing a list of transformations to apply.+ * @param string $attr the attribute of which we want the transformations.+ * @return array<string> containing a list of transformations to apply.*/private function getTransform($attr) {if (array_key_exists($attr, $this->transform)) {diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.phpindex 03ef5421b..a0e492739 100644--- a/app/Models/TagDAO.php+++ b/app/Models/TagDAO.php@@ -70,6 +70,9 @@ SQL;}}+ /**+ * @param FreshRSS_Tag $tag+ */public function addTagObject($tag) {$tag = $this->searchByName($tag->name());if (!$tag) {@@ -82,6 +85,9 @@ SQL;return $tag->id();}+ /**+ * @return integer|false+ */public function updateTag($id, $valuesTmp) {// No category of the same name$sql = <<<'SQL'@@ -111,6 +117,9 @@ SQL;}}+ /**+ * @return integer|false+ */public function updateTagAttribute($tag, $key, $value) {if ($tag instanceof FreshRSS_Tag) {$tag->_attributes($key, $value);@@ -122,6 +131,9 @@ SQL;return false;}+ /**+ * @return integer|false+ */public function deleteTag($id) {if ($id <= 0) {return false;@@ -156,6 +168,9 @@ SQL;}}+ /**+ * @return integer|false+ */public function updateEntryTag($oldTagId, $newTagId) {$sql = <<<'SQL'DELETE FROM `_entrytag` WHERE EXISTS (@@ -182,6 +197,9 @@ SQL;}}+ /**+ * @return FreshRSS_Tag+ */public function searchById($id) {$sql = 'SELECT * FROM `_tag` WHERE id=?';$stm = $this->pdo->prepare($sql);@@ -192,6 +210,9 @@ SQL;return isset($tag[0]) ? $tag[0] : null;}+ /**+ * @return FreshRSS_Tag+ */public function searchByName($name) {$sql = 'SELECT * FROM `_tag` WHERE name=?';$stm = $this->pdo->prepare($sql);diff --git a/app/Utils/feverUtil.php b/app/Utils/feverUtil.phpindex 83921943c..a7d21dacb 100644--- a/app/Utils/feverUtil.php+++ b/app/Utils/feverUtil.php@@ -23,7 +23,7 @@ class FreshRSS_fever_Util {/*** Return the corresponding path for a fever key.*- * @param string+ * @param string $feverKey* @return string*/public static function getKeyPath($feverKey) {@@ -34,9 +34,9 @@ class FreshRSS_fever_Util {/*** Update the fever key of a user.*- * @param string- * @param string- * @return string the Fever key, or false if the update failed+ * @param string $username+ * @param string $passwordPlain+ * @return string|false the Fever key, or false if the update failed*/public static function updateKey($username, $passwordPlain) {$ok = self::checkFeverPath();@@ -60,7 +60,7 @@ class FreshRSS_fever_Util {/*** Delete the Fever key of a user.*- * @param string+ * @param string $username* @return boolean true if the deletion succeeded, else false.*/public static function deleteKey($username) {diff --git a/app/Utils/passwordUtil.php b/app/Utils/passwordUtil.phpindex e382f76f5..cff97d2bc 100644--- a/app/Utils/passwordUtil.php+++ b/app/Utils/passwordUtil.php@@ -8,7 +8,7 @@ class FreshRSS_password_Util {/*** Return a hash of a plain password, using BCRYPT*- * @param string+ * @param string $passwordPlain* @return string*/public static function hash($passwordPlain) {diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtmlindex a8e78810c..bb11f9f69 100644--- a/app/views/index/logs.phtml+++ b/app/views/index/logs.phtml@@ -11,7 +11,10 @@<button type="submit" class="btn"><?= _t('index.log.clear') ?></button></p></form>- <?php $items = $this->logsPaginator->items(); ?>+ <?php+ /** @var array<FreshRSS_Log> $items */+ $items = $this->logsPaginator->items();+ ?><?php if (!empty($items)) { ?><div class="loglist">diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.phpindex 9752c21eb..539b1da62 100644--- a/lib/Minz/Configuration.php+++ b/lib/Minz/Configuration.php@@ -12,10 +12,10 @@ class Minz_Configuration {/*** Add a new configuration to the list of configuration.*- * @param $namespace the name of the current configuration- * @param $config_filename the filename of the configuration- * @param $default_filename a filename containing default values for the configuration- * @param $configuration_setter an optional helper to set values in configuration+ * @param string $namespace the name of the current configuration+ * @param string $config_filename the filename of the configuration+ * @param string $default_filename a filename containing default values for the configuration+ * @param object $configuration_setter an optional helper to set values in configuration*/public static function register($namespace, $config_filename, $default_filename = null, $configuration_setter = null) {self::$config_list[$namespace] = new Minz_Configuration(@@ -26,8 +26,8 @@ class Minz_Configuration {/*** Parse a file and return its data.*- * @param $filename the name of the file to parse.- * @return an array of values+ * @param string $filename the name of the file to parse.+ * @return array of values* @throws Minz_FileNotExistException if the file does not exist or is invalid.*/public static function load($filename) {@@ -42,7 +42,7 @@ class Minz_Configuration {/*** Return the configuration related to a given namespace.*- * @param $namespace the name of the configuration to get.+ * @param string $namespace the name of the configuration to get.* @return Minz_Configuration object* @throws Minz_ConfigurationNamespaceException if the namespace does not exist.*/@@ -102,10 +102,10 @@ class Minz_Configuration {/*** Create a new Minz_Configuration object.*- * @param $namespace the name of the current configuration.- * @param $config_filename the file containing configuration values.- * @param $default_filename the file containing default values, null by default.- * @param $configuration_setter an optional helper to set values in configuration+ * @param string $namespace the name of the current configuration.+ * @param string $config_filename the file containing configuration values.+ * @param string $default_filename the file containing default values, null by default.+ * @param object $configuration_setter an optional helper to set values in configuration*/private function __construct($namespace, $config_filename, $default_filename = null, $configuration_setter = null) {$this->namespace = $namespace;@@ -130,7 +130,7 @@ class Minz_Configuration {/*** Set a configuration setter for the current configuration.- * @param $configuration_setter the setter to call when modifying data. It+ * @param object $configuration_setter the setter to call when modifying data. It* must implement an handle($key, $value) method.*/public function _configurationSetter($configuration_setter) {@@ -155,8 +155,8 @@ class Minz_Configuration {/*** Return the value of the given param.*- * @param $key the name of the param.- * @param $default default value to return if key does not exist.+ * @param string $key the name of the param.+ * @param mixed $default default value to return if key does not exist.* @return mixed value corresponding to the key.* @throws Minz_ConfigurationParamException if the param does not exist*/@@ -181,8 +181,8 @@ class Minz_Configuration {/*** Set or remove a param.*- * @param $key the param name to set.- * @param $value the value to set. If null, the key is removed from the configuration.+ * @param string $key the param name to set.+ * @param mixed $value the value to set. If null, the key is removed from the configuration.*/public function _param($key, $value = null) {if (!is_null($this->configuration_setter) && $this->configuration_setter->support($key)) {diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.phpindex b326d4b62..f2664cbe0 100644--- a/lib/Minz/Dispatcher.php+++ b/lib/Minz/Dispatcher.php@@ -31,7 +31,7 @@ class Minz_Dispatcher {/*** Lance le controller indiqué dans Request* Remplit le body de Response à partir de la Vue- * @exception Minz_Exception+ * @throws Minz_Exception*/public function run () {do {@@ -68,10 +68,9 @@ class Minz_Dispatcher {/*** Instancie le Controller- * @param $base_name le nom du controller à instancier- * @exception ControllerNotExistException le controller n'existe pas- * @exception ControllerNotActionControllerException controller n'est- * > pas une instance de ActionController+ * @param string $base_name le nom du controller à instancier+ * @throws Minz_ControllerNotExistException le controller n'existe pas+ * @throws Minz_ControllerNotActionControllerException controller n'est pas une instance de ActionController*/private function createController ($base_name) {if (self::isRegistered($base_name)) {@@ -98,9 +97,8 @@ class Minz_Dispatcher {/*** Lance l'action sur le controller du dispatcher- * @param $action_name le nom de l'action- * @exception ActionException si on ne peut pas exécuter l'action sur- * le controller+ * @param string $action_name le nom de l'action+ * @throws Minz_ActionException si on ne peut pas exécuter l'action sur le controller*/private function launchAction ($action_name) {if (!is_callable (array (@@ -122,8 +120,8 @@ class Minz_Dispatcher {/*** Register a controller file.*- * @param $base_name the base name of the controller (i.e. ./?c=<base_name>)- * @param $base_path the base path where we should look into to find info.+ * @param string $base_name the base name of the controller (i.e. ./?c=<base_name>)+ * @param string $base_path the base path where we should look into to find info.*/public static function registerController($base_name, $base_path) {if (!self::isRegistered($base_name)) {@@ -134,8 +132,8 @@ class Minz_Dispatcher {/*** Return if a controller is registered.*- * @param $base_name the base name of the controller.- * @return true if the controller has been registered, false else.+ * @param string $base_name the base name of the controller.+ * @return boolean true if the controller has been registered, false else.*/public static function isRegistered($base_name) {return isset(self::$registrations[$base_name]);@@ -144,7 +142,7 @@ class Minz_Dispatcher {/*** Load a controller file (include).*- * @param $base_name the base name of the controller.+ * @param string $base_name the base name of the controller.*/private static function loadController($base_name) {$base_path = self::$registrations[$base_name];diff --git a/lib/Minz/Error.php b/lib/Minz/Error.phpindex 8f21210aa..32de05f0c 100644--- a/lib/Minz/Error.php+++ b/lib/Minz/Error.php@@ -12,12 +12,12 @@ class Minz_Error {/*** Permet de lancer une erreur- * @param $code le type de l'erreur, par défaut 404 (page not found)- * @param $logs logs d'erreurs découpés de la forme+ * @param int $code le type de l'erreur, par défaut 404 (page not found)+ * @param array<string> $logs logs d'erreurs découpés de la forme* > $logs['error']* > $logs['warning']* > $logs['notice']- * @param $redirect indique s'il faut forcer la redirection (les logs ne seront pas transmis)+ * @param bool $redirect indique s'il faut forcer la redirection (les logs ne seront pas transmis)*/public static function error ($code = 404, $logs = array (), $redirect = true) {$logs = self::processLogs ($logs);@@ -50,8 +50,8 @@ class Minz_Error {/*** Permet de retourner les logs de façon à n'avoir que* ceux que l'on veut réellement- * @param $logs les logs rangés par catégories (error, warning, notice)- * @return array liste des logs, sans catégorie, en fonction de l'environment+ * @param array<string> $logs les logs rangés par catégories (error, warning, notice)+ * @return array<string> liste des logs, sans catégorie, en fonction de l'environment*/private static function processLogs ($logs) {$conf = Minz_Configuration::get('system');diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.phpindex 6637ab895..82f9a0631 100644--- a/lib/Minz/Extension.php+++ b/lib/Minz/Extension.php@@ -34,7 +34,7 @@ abstract class Minz_Extension {* - version: a version for the current extension.* - type: "system" or "user" (default).*- * @param $meta_info contains information about the extension.+ * @param array<string> $meta_info contains information about the extension.*/final public function __construct($meta_info) {$this->name = $meta_info['name'];@@ -51,8 +51,7 @@ abstract class Minz_Extension {/*** Used when installing an extension (e.g. update the database scheme).*- * @return true if the extension has been installed or a string explaining- * the problem.+ * @return string|true true if the extension has been installed or a string explaining the problem.*/public function install() {return true;@@ -62,8 +61,7 @@ abstract class Minz_Extension {* Used when uninstalling an extension (e.g. revert the database scheme to* cancel changes from install).*- * @return true if the extension has been uninstalled or a string explaining- * the problem.+ * @return string|true true if the extension has been uninstalled or a string explaining the problem.*/public function uninstall() {return true;@@ -85,7 +83,7 @@ abstract class Minz_Extension {/*** Return if the extension is currently enabled.*- * @return true if extension is enabled, false else.+ * @return string|true true if extension is enabled, false otherwise.*/public function isEnabled() {return $this->is_enabled;@@ -94,7 +92,7 @@ abstract class Minz_Extension {/*** Return the content of the configure view for the current extension.*- * @return string html content from ext_dir/configure.phtml, false if it does not exist.+ * @return string|false html content from ext_dir/configure.phtml, false if it does not exist.*/public function getConfigureView() {$filename = $this->path . '/configure.phtml';@@ -146,9 +144,9 @@ abstract class Minz_Extension {/*** Return the url for a given file.*- * @param $filename name of the file to serve.- * @param $type the type (js or css) of the file to serve.- * @param $isStatic indicates if the file is a static file or a user file. Default is static.+ * @param string $filename name of the file to serve.+ * @param string $type the type (js or css) of the file to serve.+ * @param bool $isStatic indicates if the file is a static file or a user file. Default is static.* @return string url corresponding to the file.*/public function getFileUrl($filename, $type, $isStatic = true) {@@ -169,8 +167,7 @@ abstract class Minz_Extension {/*** Register a controller in the Dispatcher.*- * @param @base_name the base name of the controller. Final name will be:- * FreshExtension_<base_name>_Controller.+ * @param string $base_name the base name of the controller. Final name will be FreshExtension_<base_name>_Controller.*/public function registerController($base_name) {Minz_Dispatcher::registerController($base_name, $this->path);@@ -194,8 +191,8 @@ abstract class Minz_Extension {/*** Register a new hook.*- * @param $hook_name the hook name (must exist).- * @param $hook_function the function name to call (must be callable).+ * @param string $hook_name the hook name (must exist).+ * @param callable-string $hook_function the function name to call (must be callable).*/public function registerHook($hook_name, $hook_function) {Minz_ExtensionManager::addHook($hook_name, $hook_function, $this);diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.phpindex eb2d381c4..0139c326f 100644--- a/lib/Minz/ExtensionManager.php+++ b/lib/Minz/ExtensionManager.php@@ -324,8 +324,8 @@ class Minz_ExtensionManager {** If a hook return a null value, the method is stopped and return null.*- * @param $hook_name is the hook to call.- * @param $arg is the argument to pass to the first extension hook.+ * @param string $hook_name is the hook to call.+ * @param mixed $arg is the argument to pass to the first extension hook.* @return mixed final chained result of the hooks. If nothing is changed,* the initial argument is returned.*/@@ -366,7 +366,7 @@ class Minz_ExtensionManager {* This case is simpler than callOneToOne because hooks are called one by* one, without any consideration of argument nor result.*- * @param $hook_name is the hook to call.+ * @param string $hook_name is the hook to call.*/private static function callNoneToNone($hook_name) {foreach (self::$hook_list[$hook_name]['list'] as $function) {diff --git a/lib/Minz/Log.php b/lib/Minz/Log.phpindex 1686bdaf0..2b11f9b8b 100644--- a/lib/Minz/Log.php+++ b/lib/Minz/Log.php@@ -14,9 +14,9 @@ class Minz_Log {* - environment = SILENT* - level = LOG_WARNING et environment = PRODUCTION* - level = LOG_NOTICE et environment = PRODUCTION- * @param $information message d'erreur / information à enregistrer- * @param $level niveau d'erreur https://php.net/function.syslog- * @param $file_name fichier de log+ * @param string $information message d'erreur / information à enregistrer+ * @param int $level niveau d'erreur https://php.net/function.syslog+ * @param string $file_name fichier de log* @throws Minz_PermissionDeniedException*/public static function record ($information, $level, $file_name = null) {@@ -79,7 +79,7 @@ class Minz_Log {* This method can be called multiple times for one script execution, but its result will not change unless* you call clearstatcache() in between. We won't due do that for performance reasons.*- * @param $file_name+ * @param string $file_name* @throws Minz_PermissionDeniedException*/protected static function ensureMaxLogSize($file_name) {@@ -108,7 +108,7 @@ class Minz_Log {* Automatise le log des variables globales $_GET et $_POST* Fait appel à la fonction record(...)* Ne fonctionne qu'en environnement "development"- * @param $file_name fichier de log+ * @param string $file_name fichier de log*/public static function recordRequest($file_name = null) {$msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true));diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.phpindex eac1bac5b..d69a65422 100644--- a/lib/Minz/Migrator.php+++ b/lib/Minz/Migrator.php@@ -192,7 +192,7 @@ class Minz_Migrator/*** Set the applied versions of the application.*- * @param string[] $applied_versions+ * @param array<string> $versions** @throws DomainException if there is no migrations corresponding to a version*/diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.phpindex 4938f4b1d..814292082 100644--- a/lib/Minz/ModelArray.php+++ b/lib/Minz/ModelArray.php@@ -15,7 +15,7 @@ class Minz_ModelArray {/*** Ouvre le fichier indiqué, charge le tableau dans $array et le $filename- * @param $filename le nom du fichier à ouvrir contenant un tableau+ * @param string $filename le nom du fichier à ouvrir contenant un tableau* Remarque : $array sera obligatoirement un tableau*/public function __construct ($filename) {diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.phpindex 72eaafec1..7504bf4ce 100644--- a/lib/Minz/Paginator.php+++ b/lib/Minz/Paginator.php@@ -9,33 +9,33 @@*/class Minz_Paginator {/**- * $items tableau des éléments à afficher/gérer+ * @var array<Minz_Model> tableau des éléments à afficher/gérer*/private $items = array ();/**- * $nbItemsPerPage le nombre d'éléments par page+ * @var int le nombre d'éléments par page*/private $nbItemsPerPage = 10;/**- * $currentPage page actuelle à gérer+ * @var int page actuelle à gérer*/private $currentPage = 1;/**- * $nbPage le nombre de pages de pagination+ * @var int le nombre de pages de pagination*/private $nbPage = 1;/**- * $nbItems le nombre d'éléments+ * @var int le nombre d'éléments*/private $nbItems = 0;/*** Constructeur- * @param $items les éléments à gérer+ * @param array<Minz_Model> $items les éléments à gérer*/public function __construct ($items) {$this->_items ($items);@@ -46,11 +46,11 @@ class Minz_Paginator {/*** Permet d'afficher la pagination- * @param $view nom du fichier de vue situé dans /app/views/helpers/+ * @param string $view nom du fichier de vue situé dans /app/views/helpers/* @param int $getteur variable de type $_GET[] permettant de retrouver la page*/public function render ($view, $getteur) {- $view = APP_PATH . '/views/helpers/'.$view;+ $view = APP_PATH . '/views/helpers/' . $view;if (file_exists ($view)) {include ($view);@@ -59,7 +59,7 @@ class Minz_Paginator {/*** Permet de retrouver la page d'un élément donné- * @param $item l'élément à retrouver+ * @param Minz_Model $item l'élément à retrouver* @return float|false la page à laquelle se trouve l’élément, false si non trouvé*/public function pageByItem ($item) {@@ -77,7 +77,7 @@ class Minz_Paginator {/*** Permet de retrouver la position d'un élément donné (à partir de 0)- * @param $item l'élément à retrouver+ * @param Minz_Model $item l'élément à retrouver* @return float|false la position à laquelle se trouve l’élément, false si non trouvé*/public function positionByItem ($item) {@@ -95,7 +95,7 @@ class Minz_Paginator {/*** Permet de récupérer un item par sa position- * @param $pos la position de l'élément+ * @param int $pos la position de l'élément* @return mixed item situé à $pos (dernier item si $pos<0, 1er si $pos>=count($items))*/public function itemByPosition ($pos) {@@ -113,7 +113,8 @@ class Minz_Paginator {* GETTEURS*//**- * @param $all si à true, retourne tous les éléments sans prendre en compte la pagination+ * @param bool $all si à true, retourne tous les éléments sans prendre en compte la pagination+ * @return array<Minz_Model>*/public function items ($all = false) {$array = array ();@@ -175,7 +176,7 @@ class Minz_Paginator {$this->_nbPage ();}public function _currentPage ($page) {- if($page < 1 || ($page > $this->nbPage && $this->nbPage > 0)) {+ if ($page < 1 || ($page > $this->nbPage && $this->nbPage > 0)) {throw new Minz_CurrentPagePaginationException($page);}diff --git a/lib/Minz/Request.php b/lib/Minz/Request.phpindex 845cce7cd..7625cf5ed 100644--- a/lib/Minz/Request.php+++ b/lib/Minz/Request.php@@ -149,11 +149,11 @@ class Minz_Request {* @return string base url (e.g. http://example.com/)*/public static function guessBaseUrl() {- $protocol = static::extractProtocol();- $host = static::extractHost();- $port = static::extractPortForUrl();- $prefix = static::extractPrefix();- $path = static::extractPath();+ $protocol = self::extractProtocol();+ $host = self::extractHost();+ $port = self::extractPortForUrl();+ $prefix = self::extractPrefix();+ $path = self::extractPath();return filter_var("{$protocol}://{$host}{$port}{$prefix}{$path}", FILTER_SANITIZE_URL);}@@ -162,7 +162,7 @@ class Minz_Request {* @return string*/private static function extractProtocol() {- if (static::isHttps()) {+ if (self::isHttps()) {return 'https';}return 'http';@@ -198,17 +198,17 @@ class Minz_Request {if ('' != $port = ($_SERVER['SERVER_PORT'] ?? '')) {return intval($port);}- return static::isHttps() ? 443 : 80;+ return self::isHttps() ? 443 : 80;}/*** @return string*/private static function extractPortForUrl() {- if (static::isHttps() && 443 !== $port = static::extractPort()) {+ if (self::isHttps() && 443 !== $port = self::extractPort()) {return ":{$port}";}- if (!static::isHttps() && 80 !== $port = static::extractPort()) {+ if (!self::isHttps() && 80 !== $port = self::extractPort()) {return ":{$port}";}return '';@@ -251,7 +251,7 @@ class Minz_Request {* Note: for the moment it tests only if address is corresponding to a* localhost address.*- * @param $address the address to test, can be an IP or a URL.+ * @param string $address the address to test, can be an IP or a URL.* @return boolean true if server is accessible, false otherwise.* @todo improve test with a more valid technique (e.g. test with an external server?)*/@@ -328,8 +328,8 @@ class Minz_Request {/*** Relance une requête- * @param $url l'url vers laquelle est relancée la requête- * @param $redirect si vrai, force la redirection http+ * @param array<string,string> $url l'url vers laquelle est relancée la requête+ * @param bool $redirect si vrai, force la redirection http* > sinon, le dispatcher recharge en interne*/public static function forward($url = array(), $redirect = false) {@@ -358,14 +358,19 @@ class Minz_Request {/*** Wrappers good notifications + redirection- * @param $msg notification content- * @param $url url array to where we should be forwarded+ * @param string $msg notification content+ * @param array<string,string> $url url array to where we should be forwarded*/public static function good($msg, $url = array()) {Minz_Request::setGoodNotification($msg);Minz_Request::forward($url, true);}+ /**+ * Wrappers bad notifications + redirection+ * @param string $msg notification content+ * @param array<string,string> $url url array to where we should be forwarded+ */public static function bad($msg, $url = array()) {Minz_Request::setBadNotification($msg);Minz_Request::forward($url, true);@@ -375,7 +380,7 @@ class Minz_Request {* Allows receiving POST data as application/json*/private static function initJSON() {- if ('application/json' !== static::extractContentType()) {+ if ('application/json' !== self::extractContentType()) {return;}if ('' === $ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576)) {@@ -407,7 +412,7 @@ class Minz_Request {}/**- * @return array+ * @return array<string>*/public static function getPreferredLanguages() {if (preg_match_all('/(^|,)\s*(?P<lang>[^;,]+)/', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '', $matches)) {diff --git a/lib/Minz/Session.php b/lib/Minz/Session.phpindex 0867000e7..d5a002005 100644--- a/lib/Minz/Session.php+++ b/lib/Minz/Session.php@@ -56,7 +56,7 @@ class Minz_Session {/*** Permet de récupérer une variable de session- * @param $p le paramètre à récupérer+ * @param string $p le paramètre à récupérer* @return mixed|false la valeur de la variable de session, false si n'existe pas*/public static function param($p, $default = false) {@@ -66,8 +66,8 @@ class Minz_Session {/*** Permet de créer ou mettre à jour une variable de session- * @param $p le paramètre à créer ou modifier- * @param $v la valeur à attribuer, false pour supprimer+ * @param string $p le paramètre à créer ou modifier+ * @param mixed|false $v la valeur à attribuer, false pour supprimer*/public static function _param($p, $v = false) {if (!self::$volatile && !self::$locked) {@@ -101,7 +101,7 @@ class Minz_Session {/*** Permet d'effacer une session- * @param $force si à false, n'efface pas le paramètre de langue+ * @param bool $force si à false, n'efface pas le paramètre de langue*/public static function unset_session($force = false) {$language = self::param('language');@@ -132,13 +132,12 @@ class Minz_Session {/*** Spécifie la durée de vie des cookies- * @param $l la durée de vie+ * @param int $l la durée de vie*/public static function keepCookie($l) {session_set_cookie_params($l, self::getCookieDir(), '', Minz_Request::isHttps(), true);}-/*** Régénère un id de session.* Utile pour appeler session_set_cookie_params après session_start()diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.phpindex 61a52fc52..90e678d58 100644--- a/lib/Minz/Translate.php+++ b/lib/Minz/Translate.php@@ -31,7 +31,7 @@ class Minz_Translate {/*** Init the translation object.- * @param $lang_name the lang to show.+ * @param string $lang_name the lang to show.*/public static function init($lang_name = null) {self::$lang_name = $lang_name;@@ -45,7 +45,7 @@ class Minz_Translate {/*** Reset the translation object with a new language.- * @param $lang_name the new language to use+ * @param string $lang_name the new language to use*/public static function reset($lang_name) {self::$lang_name = $lang_name;@@ -58,7 +58,7 @@ class Minz_Translate {/*** Return the list of available languages.- * @return array containing langs found in different registered paths.+ * @return array<string> containing langs found in different registered paths.*/public static function availableLanguages() {$list_langs = array();@@ -85,9 +85,9 @@ class Minz_Translate {* Return the language to use in the application.* It returns the connected language if it exists then returns the first match from the* preferred languages then returns the default language- * @param $user the connected user language (nullable)- * @param $preferred an array of the preferred languages- * @param $default the preferred language to use+ * @param string $user the connected user language (nullable)+ * @param array<string> $preferred an array of the preferred languages+ * @param string $default the preferred language to use* @return string containing the language to use*/public static function getLanguage($user, $preferred, $default) {@@ -108,7 +108,7 @@ class Minz_Translate {/*** Register a new path.- * @param $path a path containing i18n directories (e.g. ./en/, ./fr/).+ * @param string $path a path containing i18n directories (e.g. ./en/, ./fr/).*/public static function registerPath($path) {if (!in_array($path, self::$path_list) && is_dir($path)) {@@ -119,7 +119,7 @@ class Minz_Translate {/*** Load translations of the current language from the given path.- * @param $path the path containing i18n directories.+ * @param string $path the path containing i18n directories.*/private static function loadLang($path) {$lang_path = $path . '/' . self::$lang_name;@@ -148,7 +148,7 @@ class Minz_Translate {/*** Load the files associated to $key into $translates.- * @param $key the top level i18n key we want to load.+ * @param string $key the top level i18n key we want to load.*/private static function loadKey($key) {// The top level key is not in $lang_files, it means it does not exist!@@ -178,7 +178,7 @@ class Minz_Translate {/*** Translate a key into its corresponding value based on selected language.- * @param $key the key to translate.+ * @param string $key the key to translate.* @param additional parameters for variable keys.* @return string value corresponding to the key.* If no value is found, return the key itself.diff --git a/lib/Minz/Url.php b/lib/Minz/Url.phpindex 844e5062d..a1019df50 100644--- a/lib/Minz/Url.php+++ b/lib/Minz/Url.php@@ -6,12 +6,13 @@class Minz_Url {/*** Affiche une Url formatée- * @param $url l'url à formater définie comme un tableau :+ * @param array<string,string> $url l'url à formater définie comme un tableau :* $url['c'] = controller* $url['a'] = action* $url['params'] = tableau des paramètres supplémentaires* ou comme une chaîne de caractère- * @param $encodage pour indiquer comment encoder les & (& ou & pour html)+ * @param string $encodage pour indiquer comment encoder les & (& ou & pour html)+ * @param bool $absolute* @return string url formatée*/public static function display ($url = array (), $encodage = 'html', $absolute = false) {@@ -55,8 +56,8 @@ class Minz_Url {/*** Construit l'URI d'une URL- * @param l'url sous forme de tableau- * @param $encodage pour indiquer comment encoder les & (& ou & pour html)+ * @param array<string,mixed> $url l'url sous forme de tableau+ * @param string $encodage pour indiquer comment encoder les & (& ou & pour html)* @return string uri sous la forme ?key=value&key2=value2*/private static function printUri($url, $encodage) {@@ -95,7 +96,7 @@ class Minz_Url {/*** Vérifie que les éléments du tableau représentant une url soit ok- * @param array|string $url sous forme de tableau (sinon renverra directement $url)+ * @param array<string,string>|string $url sous forme de tableau (sinon renverra directement $url)* @return string url vérifié*/public static function checkUrl ($url) {diff --git a/lib/Minz/View.php b/lib/Minz/View.phpindex c208621a4..bc38b8783 100644--- a/lib/Minz/View.php+++ b/lib/Minz/View.php@@ -54,7 +54,7 @@ class Minz_View {** New pathnames will be added at the beginning of the list.*- * @param $base_pathname the new base pathname.+ * @param string $base_pathname the new base pathname.*/public static function addBasePathname($base_pathname) {array_unshift(self::$base_pathnames, $base_pathname);@@ -76,7 +76,7 @@ class Minz_View {** The file is searched inside list of $base_pathnames.*- * @param $filename the name of the file to include.+ * @param string $filename the name of the file to include.* @return boolean true if the file has been included, false else.*/private function includeFile($filename) {@@ -114,7 +114,7 @@ class Minz_View {/*** Ajoute un élément du layout- * @param $part l'élément partial à ajouter+ * @param string $part l'élément partial à ajouter*/public function partial ($part) {$fic_partial = self::LAYOUT_PATH_NAME . '/' . $part . '.phtml';@@ -125,7 +125,7 @@ class Minz_View {/*** Affiche un élément graphique situé dans APP./views/helpers/- * @param $helper l'élément à afficher+ * @param string $helper l'élément à afficher*/public function renderHelper ($helper) {$fic_helper = '/views/helpers/' . $helper . '.phtml';@@ -136,7 +136,7 @@ class Minz_View {/*** Retourne renderHelper() dans une chaîne- * @param $helper l'élément à traîter+ * @param string $helper l'élément à traîter*/public function helperToString($helper) {ob_start();@@ -146,7 +146,7 @@ class Minz_View {/*** Choose the current view layout.- * @param $layout the layout name to use, false to use no layouts.+ * @param string $layout the layout name to use, false to use no layouts.*/public function _layout($layout) {if ($layout) {@@ -157,9 +157,9 @@ class Minz_View {}/**- * [deprecated] Choose if we want to use the layout or not.- * Please use the `_layout` function instead.- * @param $use true if we want to use the layout, false else+ * Choose if we want to use the layout or not.+ * @deprecated Please use the `_layout` function instead.+ * @param bool $use true if we want to use the layout, false else*/public function _useLayout ($use) {Minz_Log::warning('Minz_View::_useLayout is deprecated, it will be removed in a future version. Please use Minz_View::_layout instead.');diff --git a/lib/lib_rss.php b/lib/lib_rss.phpindex 6643dc757..93463bace 100644--- a/lib/lib_rss.php+++ b/lib/lib_rss.php@@ -285,7 +285,7 @@ function validateEmailAddress($email) {/*** Add support of image lazy loading* Move content from src attribute to data-original- * @param content is the text we want to parse+ * @param string $content is the text we want to parse*/function lazyimg($content) {return preg_replace(@@ -349,8 +349,8 @@ function max_registrations_reached() {* Note this function has been created to generate temporary configuration* objects. If you need a long-time configuration, please don't use this function.*- * @param $username the name of the user of which we want the configuration.- * @return Minz_Configuration object, null if the configuration cannot be loaded.+ * @param string $username the name of the user of which we want the configuration.+ * @return Minz_Configuration|null object, or null if the configuration cannot be loaded.*/function get_user_configuration($username) {if (!FreshRSS_user_Controller::checkUsername($username)) {@@ -398,7 +398,7 @@ function cryptAvailable() {/*** Check PHP and its extensions are well-installed.*- * @return array of tested values.+ * @return array<string,bool> of tested values.*/function check_install_php() {$pdo_mysql = extension_loaded('pdo_mysql');@@ -422,7 +422,7 @@ function check_install_php() {/*** Check different data files and directories exist.*- * @return array of tested values.+ * @return array<string,bool> of tested values.*/function check_install_files() {return array(@@ -438,7 +438,7 @@ function check_install_files() {/*** Check database is well-installed.*- * @return array of tested values.+ * @return array<string,bool> of tested values.*/function check_install_database() {$status = array(@@ -474,7 +474,7 @@ function check_install_database() {** From http://php.net/rmdir#110489*- * @param $dir the directory to remove+ * @param string $dir the directory to remove*/function recursive_unlink($dir) {if (!is_dir($dir)) {@@ -497,9 +497,9 @@ function recursive_unlink($dir) {/*** Remove queries where $get is appearing.- * @param $get the get attribute which should be removed.- * @param $queries an array of queries.- * @return array whithout queries where $get is appearing.+ * @param string $get the get attribute which should be removed.+ * @param array<string,string> $queries an array of queries.+ * @return array<string,string> whithout queries where $get is appearing.*/function remove_query_by_get($get, $queries) {$final_queries = array();diff --git a/p/ext.php b/p/ext.phpindex a19c9e90e..aa6972d83 100644--- a/p/ext.php+++ b/p/ext.php@@ -74,8 +74,8 @@ function is_valid_path_extension($path, $extensionPath, $isStatic = true) {** You should sanitize path by using the realpath() function.*- * @param $path the path to the file we want to serve.- * @return true if it can be served, false otherwise.+ * @param string $path the path to the file we want to serve.+ * @return bool true if it can be served, false otherwise.**/function is_valid_path($path) {