diff options
| author | 2024-06-09 20:32:12 +0200 | |
|---|---|---|
| committer | 2024-06-09 20:32:12 +0200 | |
| commit | 5b28a35003a015e29770094932157f13a3f7f5c0 (patch) | |
| tree | 4cbe4100379ca0d148115ad31f5a1c0c95ff7c80 /lib/Minz/Helper.php | |
| parent | e98c57841b843ed881f06ce6ed1c9c89942c27b8 (diff) | |
Pass PHPStan level 9 (#6544)
* More PHPStan
* More, passing
* 4 more files
* Update to PHPStan 1.11.4
Needed for fixed bug: Consider numeric-string types after string concat
https://github.com/phpstan/phpstan/releases/tag/1.11.4
* Pass PHPStan level 9
Start tracking booleansInConditions
* Fix mark as read
* Fix doctype
* ctype_digit
Diffstat (limited to 'lib/Minz/Helper.php')
| -rw-r--r-- | lib/Minz/Helper.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index 04539ec40..50243ded0 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -9,23 +9,25 @@ declare(strict_types=1); /** * The Minz_Helper class contains some misc. help functions */ -class Minz_Helper { +final class Minz_Helper { /** * Wrapper for htmlspecialchars. - * Force UTf-8 value and can be used on array too. + * Force UTF-8 value and can be used on array too. * - * @phpstan-template T of string|array<mixed> + * @phpstan-template T of mixed * @phpstan-param T $var * @phpstan-return T * - * @param string|array<mixed> $var - * @return string|array<mixed> + * @param mixed $var + * @return mixed */ public static function htmlspecialchars_utf8($var) { if (is_array($var)) { - return array_map(['Minz_Helper', 'htmlspecialchars_utf8'], $var); + // @phpstan-ignore argument.type, return.type + return array_map([self::class, 'htmlspecialchars_utf8'], $var); } elseif (is_string($var)) { + // @phpstan-ignore return.type return htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } else { return $var; |
