aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Url.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-01-04 13:59:09 +0100
committerGravatar GitHub <noreply@github.com> 2022-01-04 13:59:09 +0100
commit1335a0e3cf11a0d4248e9eaaf748b89e6df741ef (patch)
treeed6a8d17cef0581e5b0402dc8dfedd42fabfe9c7 /lib/Minz/Url.php
parent0988b0c2be911133f883313bc3a858670192cc69 (diff)
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
Diffstat (limited to 'lib/Minz/Url.php')
-rw-r--r--lib/Minz/Url.php13
1 files changed, 7 insertions, 6 deletions
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<string,string> $url l'url à formater définie comme un tableau :
+ * @param string|array<string,string|array<string,mixed>> $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 &amp; 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,string>|string $url sous forme de tableau (sinon renverra directement $url)
- * @return string url vérifié
+ * @param array<string,array<string,string>> $url sous forme de tableau
+ * @return array<string,array<string,string>> 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<string,string> $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));