diff options
author | Simon Rettberg | 2023-11-14 14:47:55 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-11-14 14:47:55 +0100 |
commit | 06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch) | |
tree | 7e5493b102074672d8cfd8fe1a61e49f080edbe8 /modules-available/locations/pages | |
parent | Update phpstorm config (diff) | |
download | slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip |
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'modules-available/locations/pages')
4 files changed, 19 insertions, 18 deletions
diff --git a/modules-available/locations/pages/cleanup.inc.php b/modules-available/locations/pages/cleanup.inc.php index a7562c50..423d6a6b 100644 --- a/modules-available/locations/pages/cleanup.inc.php +++ b/modules-available/locations/pages/cleanup.inc.php @@ -3,7 +3,7 @@ class SubPage { - public static function doPreprocess($action) + public static function doPreprocess($action): bool { if ($action === 'resetmachines') { self::resetMachines(); @@ -16,7 +16,7 @@ class SubPage return false; } - public static function doRender($action) + public static function doRender($action): bool { $list = self::loadForLocation(); if ($list === false) @@ -29,7 +29,7 @@ class SubPage return true; } - public static function doAjax($action) + public static function doAjax($action): bool { return false; } diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php index e75aaf7d..279eee44 100644 --- a/modules-available/locations/pages/details.inc.php +++ b/modules-available/locations/pages/details.inc.php @@ -3,24 +3,25 @@ class SubPage { - public static function doPreprocess($action) + public static function doPreprocess($action): bool { if ($action === 'updatelocation') { self::updateLocation(); return true; - } else if ($action === 'updateOpeningtimes') { + } + if ($action === 'updateOpeningtimes') { self::updateOpeningTimes(); return true; } return false; } - public static function doRender($action) + public static function doRender($action): bool { return false; } - public static function doAjax($action) + public static function doAjax($action): bool { if ($action === 'showlocation') { self::ajaxShowLocation(); @@ -172,7 +173,7 @@ class SubPage Util::redirect('?do=Locations'); } - private static function updateLocationData($location) + private static function updateLocationData(array $location): bool { $locationId = (int)$location['locationid']; $newParent = Request::post('parentlocationid', false, 'integer'); @@ -216,7 +217,7 @@ class SubPage return $newParent != $location['parentlocationid']; } - private static function updateLocationSubnets() + private static function updateLocationSubnets(): bool { $locationId = Request::post('locationid', false, 'integer'); if (!User::hasPermission('location.edit.subnets', $locationId)) @@ -257,7 +258,7 @@ class SubPage continue; } $range = LocationUtil::rangeToLongVerbose($start, $end); - if ($range === false) + if ($range === null) continue; list($startLong, $endLong) = $range; if ($stmt->execute(array('id' => $subnetid, 'start' => $startLong, 'end' => $endLong))) { @@ -275,7 +276,7 @@ class SubPage return $change; } - private static function addNewLocationSubnets($location) + private static function addNewLocationSubnets(array $location): bool { $locationId = (int)$location['locationid']; if (!User::hasPermission('location.edit.subnets', $locationId)) diff --git a/modules-available/locations/pages/locations.inc.php b/modules-available/locations/pages/locations.inc.php index 8ba4793e..78818328 100644 --- a/modules-available/locations/pages/locations.inc.php +++ b/modules-available/locations/pages/locations.inc.php @@ -3,7 +3,7 @@ class SubPage { - public static function doPreprocess($action) + public static function doPreprocess($action): bool { if ($action === 'addlocations') { self::addLocations(); @@ -12,7 +12,7 @@ class SubPage return false; } - public static function doRender($getAction) + public static function doRender($getAction): bool { if ($getAction === false) { if (User::hasPermission('location.view')) { @@ -32,7 +32,7 @@ class SubPage return false; } - public static function doAjax($action) + public static function doAjax($action): bool { return false; } diff --git a/modules-available/locations/pages/subnets.inc.php b/modules-available/locations/pages/subnets.inc.php index e568c655..7628486b 100644 --- a/modules-available/locations/pages/subnets.inc.php +++ b/modules-available/locations/pages/subnets.inc.php @@ -3,7 +3,7 @@ class SubPage { - public static function doPreprocess($action) + public static function doPreprocess(string $action): bool { if ($action === 'updatesubnets') { self::updateSubnets(); @@ -42,7 +42,7 @@ class SubPage continue; } $range = LocationUtil::rangeToLongVerbose($start, $end); - if ($range === false) + if ($range === null) continue; list($startLong, $endLong) = $range; if ($stmt->execute(compact('startLong', 'endLong', 'loc', 'subnetid'))) { @@ -59,7 +59,7 @@ class SubPage Util::redirect('?do=Locations'); } - public static function doRender($getAction) + public static function doRender($getAction): bool { if ($getAction === false) { User::assertPermission('subnets.edit', NULL, '?do=locations'); @@ -81,7 +81,7 @@ class SubPage return false; } - public static function doAjax($action) + public static function doAjax($action): bool { return false; } |