From 06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 14 Nov 2023 14:47:55 +0100 Subject: Add function param/return types, fix a lot more phpstorm complaints --- modules-available/roomplanner/inc/pvsgenerator.inc.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'modules-available/roomplanner/inc/pvsgenerator.inc.php') diff --git a/modules-available/roomplanner/inc/pvsgenerator.inc.php b/modules-available/roomplanner/inc/pvsgenerator.inc.php index f23dcb20..f3c5c838 100644 --- a/modules-available/roomplanner/inc/pvsgenerator.inc.php +++ b/modules-available/roomplanner/inc/pvsgenerator.inc.php @@ -3,7 +3,7 @@ class PvsGenerator { - public static function generate() + public static function generate(): string { /* collect names and build room blocks - filter empty rooms while at it */ $roomNames = array(); @@ -36,7 +36,7 @@ class PvsGenerator * @param Room $room room/location data as fetched from db * @return string|false .ini section for room, or false if room is empty */ - private static function generateRoomBlock($room) + private static function generateRoomBlock(Room $room) { $room->getSize($sizeX, $sizeY); if ($sizeX === 0 || $sizeY === 0) @@ -91,13 +91,13 @@ class PvsGenerator } // Load room $room = Room::get($locationId); - if ($room === false) + if ($room === null) return false; $room->getSize($sizeX, $sizeY); if ($sizeX === 0 || $sizeY === 0) return false; // Empty - $machines = $room->getShiftedArray(); + $machines = $room->getShiftedArray() ?? []; $ORIENTATION = ['north' => 2, 'east' => 3, 'south' => 0, 'west' => 1]; if (is_string($highlightUuid)) { $highlightUuid = strtoupper($highlightUuid); @@ -176,14 +176,12 @@ class PvsGenerator /** * Get display name for manager of given locationId. * Hook for "runmode" module to resolve mode name. - * @param $locationId - * @return bool|string */ - public static function getManagerName($locationId) + public static function getManagerName(int $locationId): ?string { $names = Location::getNameChain($locationId); if ($names === false) - return false; + return null; return implode(' / ', $names); } -- cgit v1.2.3-55-g7522