From aa49154e5a9ee135c3f0286ddda8a01a5290b1ed Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 15 Nov 2023 17:53:47 +0100 Subject: Fix more type errors, stricter typing --- modules-available/locations/inc/locationutil.inc.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'modules-available/locations') diff --git a/modules-available/locations/inc/locationutil.inc.php b/modules-available/locations/inc/locationutil.inc.php index 17608203..91117445 100644 --- a/modules-available/locations/inc/locationutil.inc.php +++ b/modules-available/locations/inc/locationutil.inc.php @@ -169,7 +169,7 @@ class LocationUtil return ($net1['startaddr'] <= $net2['endaddr'] && $net1['endaddr'] >= $net2['startaddr']); } - public static function rangeToLongVerbose(int $start, int $end): ?array + public static function rangeToLongVerbose(string $start, string $end): ?array { $result = self::rangeToLong($start, $end); list($startLong, $endLong) = $result; @@ -188,16 +188,11 @@ class LocationUtil return $result; } - public static function rangeToLong(int $start, int $end): array + /** @return array{0: int, 1: int} */ + public static function rangeToLong(string $start, string $end): array { $startLong = ip2long($start); $endLong = ip2long($end); - if ($startLong !== false) { - $startLong = sprintf("%u", $startLong); - } - if ($endLong !== false) { - $endLong = sprintf("%u", $endLong); - } return array($startLong, $endLong); } -- cgit v1.2.3-55-g7522