From 3953549438e7b54f6095f8a4d874780c0a065d8d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 12 May 2022 18:06:17 +0200 Subject: [rebootcontrol] Add types --- .../rebootcontrol/inc/rebootcontrol.inc.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'modules-available/rebootcontrol') diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php index e936b94e..19590670 100644 --- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php +++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php @@ -25,7 +25,7 @@ class RebootControl * @param bool $kexec whether to trigger kexec-reboot instead of full BIOS cycle * @return false|array task struct for the reboot job */ - public static function reboot($uuids, $kexec = false) + public static function reboot(array $uuids, bool $kexec = false) { $list = RebootUtils::getMachinesByUuid($uuids); if (empty($list)) @@ -39,7 +39,7 @@ class RebootControl * @param int $minutes delay in minutes for action * @return array|false the task, or false if it could not be started */ - public static function execute($list, $mode, $minutes) + public static function execute(array $list, string $mode, int $minutes) { $task = Taskmanager::submit("RemoteReboot", array( "clients" => $list, @@ -90,7 +90,7 @@ class RebootControl * @param ?string $id only with this TaskID * @return array|false list of active tasks for reboots/shutdowns. */ - public static function getActiveTasks(array $locations = null, $id = null) + public static function getActiveTasks(array $locations = null, string $id = null) { if (is_array($locations) && in_array(0, $locations)) { $locations = null; @@ -145,7 +145,7 @@ class RebootControl * @param string|false $privkey SSH private key to use to connect * @return array|false */ - public static function runScript($clients, $command, $timeout = 5, $privkey = false) + public static function runScript(array $clients, string $command, int $timeout = 5, $privkey = false) { $task = self::runScriptInternal($clients, $command, $timeout, $privkey); if (!Taskmanager::isFailed($task)) { @@ -154,7 +154,7 @@ class RebootControl return $task; } - private static function runScriptInternal(&$clients, $command, $timeout = 5, $privkey = false) + private static function runScriptInternal(array &$clients, string $command, int $timeout = 5, $privkey = false) { $valid = []; $invalid = []; @@ -213,11 +213,11 @@ class RebootControl /** * @param string|string[] $macs - * @param $bcast - * @param $passwd + * @param ?string $bcast + * @param ?string $passwd * @return string */ - private static function buildClientWakeCommand($macs, $bcast = false, $passwd = false): string + private static function buildClientWakeCommand($macs, string $bcast = null, string $passwd = null): string { $command = 'jawol'; if (!empty($bcast)) { @@ -237,9 +237,9 @@ class RebootControl /** * @param array $sourceMachines list of source machines. array of [clientip, machineuuid] entries - * @param string $bcast directed broadcast address to send to * @param string|string[] $macaddr destination mac address(es) - * @param string $passwd optional WOL password, mac address or ipv4 notation + * @param ?string $bcast directed broadcast address to send to + * @param ?string $passwd optional WOL password, mac address or ipv4 notation * @return array|false task struct, false on error */ public static function wakeViaClient($sourceMachines, $macaddr, string $bcast = null, string $passwd = null) -- cgit v1.2.3-55-g7522