diff options
| author | 2022-01-01 11:26:56 +0100 | |
|---|---|---|
| committer | 2022-01-01 11:26:56 +0100 | |
| commit | 3f6aa42b817145a3b00f4d615f87728b55c4413a (patch) | |
| tree | e5b31941b0acc3a2f4c47e4846afcfe987b9852f /lib | |
| parent | 77e9877316fcfacb26799afdf32d94c8411da80e (diff) | |
Fix most PHPDocs errors (#4107)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Configuration.php | 32 | ||||
| -rw-r--r-- | lib/Minz/Dispatcher.php | 24 | ||||
| -rw-r--r-- | lib/Minz/Error.php | 10 | ||||
| -rw-r--r-- | lib/Minz/Extension.php | 25 | ||||
| -rw-r--r-- | lib/Minz/ExtensionManager.php | 6 | ||||
| -rw-r--r-- | lib/Minz/Log.php | 10 | ||||
| -rw-r--r-- | lib/Minz/Migrator.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ModelArray.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Paginator.php | 27 | ||||
| -rw-r--r-- | lib/Minz/Request.php | 37 | ||||
| -rw-r--r-- | lib/Minz/Session.php | 11 | ||||
| -rw-r--r-- | lib/Minz/Translate.php | 20 | ||||
| -rw-r--r-- | lib/Minz/Url.php | 11 | ||||
| -rw-r--r-- | lib/Minz/View.php | 18 | ||||
| -rw-r--r-- | lib/lib_rss.php | 20 |
15 files changed, 128 insertions, 127 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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.php index 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(); |
