aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Error.php2
-rw-r--r--lib/Minz/Paginator.php8
-rw-r--r--lib/Minz/Request.php2
-rw-r--r--lib/Minz/View.php2
-rw-r--r--lib/lib_rss.php5
5 files changed, 9 insertions, 10 deletions
diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php
index e95fd346c..e44ec8579 100644
--- a/lib/Minz/Error.php
+++ b/lib/Minz/Error.php
@@ -52,7 +52,7 @@ class Minz_Error {
* @param string|array<'error'|'warning'|'notice',list<string>> $logs logs sorted by category (error, warning, notice)
* @return list<string> list of matching logs, without the category, according to environment preferences (production / development)
*/
- private static function processLogs($logs): array {
+ private static function processLogs(string|array $logs): array {
if (is_string($logs)) {
return [$logs];
}
diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php
index 7d6892c67..265b0c2cb 100644
--- a/lib/Minz/Paginator.php
+++ b/lib/Minz/Paginator.php
@@ -64,11 +64,11 @@ class Minz_Paginator {
* @param Minz_Model $item l'élément à retrouver
* @return int|false la page à laquelle se trouve l’élément, false si non trouvé
*/
- public function pageByItem($item): int|false {
+ public function pageByItem(Minz_Model $item): int|false {
$i = 0;
do {
- if ($item == $this->items[$i]) {
+ if ($item === $this->items[$i]) {
return (int)(ceil(($i + 1) / $this->nbItemsPerPage));
}
$i++;
@@ -82,11 +82,11 @@ class Minz_Paginator {
* @param Minz_Model $item the element to search
* @return int|false the position of the element, or false if not found
*/
- public function positionByItem($item): int|false {
+ public function positionByItem(Minz_Model $item): int|false {
$i = 0;
do {
- if ($item == $this->items[$i]) {
+ if ($item === $this->items[$i]) {
return $i;
}
$i++;
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index f441bcabf..3304ad480 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -432,7 +432,7 @@ class Minz_Request {
* @param bool $redirect If true, uses an HTTP redirection, and if false (default), performs an internal dispatcher redirection.
* @throws Minz_ConfigurationException
*/
- public static function forward($url = [], bool $redirect = false): void {
+ public static function forward(array $url = [], bool $redirect = false): void {
if (empty(Minz_Request::originalRequest())) {
self::$originalRequest = $url;
}
diff --git a/lib/Minz/View.php b/lib/Minz/View.php
index 01e8501b0..65573c7bd 100644
--- a/lib/Minz/View.php
+++ b/lib/Minz/View.php
@@ -247,7 +247,7 @@ class Minz_View {
/**
* @param string|array{dark?:string,light?:string,default?:string} $themeColors
*/
- public static function appendThemeColors($themeColors): void {
+ public static function appendThemeColors(string|array $themeColors): void {
self::$themeColors = $themeColors;
}
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index c93243eff..2a5bdd02f 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -217,8 +217,7 @@ function escapeToUnicodeAlternative(string $text, bool $extended = true): string
return trim(str_replace($problem, $replace, $text));
}
-/** @param int|float $n */
-function format_number($n, int $precision = 0): string {
+function format_number(int|float $n, int $precision = 0): string {
// number_format does not seem to be Unicode-compatible
return str_replace(' ', ' ', // Thin non-breaking space
number_format((float)$n, $precision, '.', ' ')
@@ -274,7 +273,7 @@ function html_only_entity_decode(?string $text): string {
* @param array<string,mixed>|string $log
* @return array<string,mixed>|string
*/
-function sensitive_log($log): array|string {
+function sensitive_log(array|string $log): array|string {
if (is_array($log)) {
foreach ($log as $k => $v) {
if (in_array($k, ['api_key', 'Passwd', 'T'], true)) {