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 --- lib/Minz/Url.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Minz/Url.php') diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index 59afff557..777962e25 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -6,13 +6,13 @@ class Minz_Url { /** * Affiche une Url formatée - * @param array $url l'url à formater définie comme un tableau : + * @param string|array> $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 string $encodage pour indiquer comment encoder les & (& ou & pour html) - * @param bool $absolute + * @param bool|string $absolute * @return string url formatée */ public static function display ($url = array (), $encodage = 'html', $absolute = false) { @@ -96,8 +96,8 @@ 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) - * @return string url vérifié + * @param array> $url sous forme de tableau + * @return array> url vérifié */ public static function checkUrl ($url) { $url_checked = $url; @@ -121,7 +121,7 @@ class Minz_Url { /** * @param string $controller * @param string $action - * @param array $args + * @param string $args */ function _url ($controller, $action, ...$args) { $nb_args = count($args); @@ -132,7 +132,8 @@ function _url ($controller, $action, ...$args) { $params = array (); for ($i = 0; $i < $nb_args; $i += 2) { - $params[$args[$i]] = $args[$i + 1]; + $arg = $args[$i]; + $params[$arg] = $args[$i + 1]; } return Minz_Url::display (array ('c' => $controller, 'a' => $action, 'params' => $params)); -- cgit v1.2.3