Files
FreshRSS/lib/Minz/Helper.php
Alexandre Alapetite a80a5f48a1 Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels

* Revert wrong replace in comment

* Fix PHPStan level 8

* Update PHPStan and other dev dependencies

* Remove obsolete comment

* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge

* More bleedingEdge

* A bit more PHPStan level 9

* More PHPStan level 9

* Prepare for booleansInConditions
Ignore int and null

* Revert wrong line

* More fixes

* Fix keep_max_n_unread

* Stricter attribute functions

* Stricter callHooks and more PHPStan level 9

* More typing

* A tiny more
2023-12-18 17:59:16 +01:00

35 lines
761 B
PHP

<?php
declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
/**
* The Minz_Helper class contains some misc. help functions
*/
class Minz_Helper {
/**
* Wrapper for htmlspecialchars.
* Force UTf-8 value and can be used on array too.
*
* @phpstan-template T of string|array<mixed>
* @phpstan-param T $var
* @phpstan-return T
*
* @param string|array<mixed> $var
* @return string|array<mixed>
*/
public static function htmlspecialchars_utf8($var) {
if (is_array($var)) {
return array_map(['Minz_Helper', 'htmlspecialchars_utf8'], $var);
} elseif (is_string($var)) {
return htmlspecialchars($var, ENT_COMPAT, 'UTF-8');
} else {
return $var;
}
}
}