diff options
author | Simon Rettberg | 2025-08-01 13:41:49 +0200 |
---|---|---|
committer | Simon Rettberg | 2025-08-01 13:41:49 +0200 |
commit | 429cfb1677ec77c5a945f655d9405d038d3e5a2c (patch) | |
tree | b3fbb729cb2231f4163b96a67046ad878f48d1b4 | |
parent | [minilinux] show -> action for POST actions (diff) | |
download | slx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.tar.gz slx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.tar.xz slx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.zip |
Implicitly nullable types are deprecated in PHP 8.3, make explicit
31 files changed, 54 insertions, 57 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php index 278fd8f0..949e6825 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -71,7 +71,7 @@ class Database * * @return array|boolean Associative array representing row, or false if no row matches the query */ - public static function queryFirst(string $query, array $args = [], bool $ignoreError = null) + public static function queryFirst(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -86,7 +86,7 @@ class Database * * @return array|bool List of associative arrays representing rows, or false on error */ - public static function queryAll(string $query, array $args = [], bool $ignoreError = null) + public static function queryAll(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -99,7 +99,7 @@ class Database * * @return array|bool List of values representing first column of query */ - public static function queryColumnArray(string $query, array $args = [], bool $ignoreError = null) + public static function queryColumnArray(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -112,7 +112,7 @@ class Database * * @return array|bool Associative array, first column is key, second column is value */ - public static function queryKeyValueList(string $query, array $args = [], bool $ignoreError = null) + public static function queryKeyValueList(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -132,7 +132,7 @@ class Database * * @return array|bool Associative array, first column is key, remaining columns are array values */ - public static function queryGroupList(string $query, array $args = [], bool $ignoreError = null) + public static function queryGroupList(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -147,7 +147,7 @@ class Database * * @return array|bool Associative array, first column is key, remaining columns are array values */ - public static function queryIndexedList(string $query, array $args = [], bool $ignoreError = null) + public static function queryIndexedList(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -164,7 +164,7 @@ class Database * @param ?bool $ignoreError Ignore query errors and just return false * @return int|boolean Number of rows affected, or false on error */ - public static function exec(string $query, array $args = [], bool $ignoreError = null) + public static function exec(string $query, array $args = [], ?bool $ignoreError = null) { $res = self::simpleQuery($query, $args, $ignoreError); if ($res === false) @@ -198,7 +198,7 @@ class Database * * @return \PDOStatement|false The query result object */ - public static function simpleQuery(string $query, array $args = [], bool $ignoreError = null) + public static function simpleQuery(string $query, array $args = [], ?bool $ignoreError = null) { self::init(); if (CONFIG_DEBUG && !isset(self::$explainList[$query]) && preg_match('/^\s*SELECT/i', $query)) { @@ -417,7 +417,7 @@ class Database * @param ?array $additionalValues assoc array containing columnName => value mapping * @return int AUTO_INCREMENT value matching the given unique values entry */ - public static function insertIgnore(string $table, string $aiKey, array $uniqueValues, array $additionalValues = null): int + public static function insertIgnore(string $table, string $aiKey, array $uniqueValues, ?array $additionalValues = null): int { // Sanity checks if (array_key_exists($aiKey, $uniqueValues)) { diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php index f95cb384..c1c14e59 100644 --- a/inc/dictionary.inc.php +++ b/inc/dictionary.inc.php @@ -265,7 +265,7 @@ class Dictionary * @param $langCC ?string Language cc to get flag code for - defaults to current language * @return string html code of img tag for language */ - public static function getFlagHtml(bool $caption = false, string $langCC = null): string + public static function getFlagHtml(bool $caption = false, ?string $langCC = null): string { if ($langCC === null) { $langCC = LANG; diff --git a/inc/mailer.inc.php b/inc/mailer.inc.php index bfdcd320..d6aea545 100644 --- a/inc/mailer.inc.php +++ b/inc/mailer.inc.php @@ -21,7 +21,7 @@ class Mailer private $from; // $keys = array('host', 'port', 'ssl', 'senderAddress', 'replyTo', 'username', 'password', 'serverName'); - public function __construct(string $hosturi, bool $startTls, string $from, string $user, string $pass, string $replyTo = null) + public function __construct(string $hosturi, bool $startTls, string $from, string $user, string $pass, ?string $replyTo = null) { $this->from = $from; if (preg_match('/[^<>"\'\s]+@[^<>"\'\s]+/i', $from, $out)) { diff --git a/inc/paginate.inc.php b/inc/paginate.inc.php index 7757228a..806e2f41 100644 --- a/inc/paginate.inc.php +++ b/inc/paginate.inc.php @@ -15,7 +15,7 @@ class Paginate * @param int $perPage - Number of items to show per page * @param ?string $url - URL of current wegpage */ - public function __construct(string $query, int $perPage, string $url = null) + public function __construct(string $query, int $perPage, ?string $url = null) { $this->currentPage = (isset($_GET['page']) ? (int)$_GET['page'] : 0); $this->perPage = $perPage; diff --git a/inc/property.inc.php b/inc/property.inc.php index aaf03254..7c4c694f 100644 --- a/inc/property.inc.php +++ b/inc/property.inc.php @@ -124,7 +124,7 @@ class Property * @return bool whether the entry existed and has been updated */ public static function updateListEntry(string $key, int $subkey, string $value, - int $maxAgeMinutes = 0, string $expectedValue = null): bool + int $maxAgeMinutes = 0, ?string $expectedValue = null): bool { $args = [ 'name' => $key, diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php index b165e2f3..4a83e496 100644 --- a/inc/taskmanager.inc.php +++ b/inc/taskmanager.inc.php @@ -53,7 +53,7 @@ class Taskmanager * the return value is just true (and you won't know if the task could actually be started) * @return array{id: string, statusCode: string, data: array}|bool struct representing the task status (as a result of submit); false on communication error */ - public static function submit(string $task, array $data = null, bool $async = false) + public static function submit(string $task, ?array $data = null, ?bool $async = false) { self::init(); $seq = (string) mt_rand(); diff --git a/inc/taskmanagercallback.inc.php b/inc/taskmanagercallback.inc.php index 536c899e..c81eaf85 100644 --- a/inc/taskmanagercallback.inc.php +++ b/inc/taskmanagercallback.inc.php @@ -71,7 +71,7 @@ class TaskmanagerCallback * @param array $callback entry from the callback table (cbfunction + taskid + args) * @param ?array $status status of the task as returned by the taskmanager. If NULL it will be queried. */ - public static function handleCallback(array $callback, array $status = NULL): void + public static function handleCallback(array $callback, ?array $status = null): void { if (is_null($status)) $status = Taskmanager::status($callback['taskid']); diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php index d0d5d365..4f52ab5f 100644 --- a/inc/trigger.inc.php +++ b/inc/trigger.inc.php @@ -19,7 +19,7 @@ class Trigger * * @return ?string null if launching task failed, task-id otherwise */ - public static function ipxe(string $taskId = null): ?string + public static function ipxe(?string $taskId = null): ?string { static $lastResult = null; if ($lastResult !== null) diff --git a/modules-available/adduser/page.inc.php b/modules-available/adduser/page.inc.php index 0ef28a3e..ea753929 100644 --- a/modules-available/adduser/page.inc.php +++ b/modules-available/adduser/page.inc.php @@ -215,7 +215,7 @@ class Page_AddUser extends Page } } - private function showRoles(int $userid = null): void + private function showRoles(?int $userid = null): void { if (!Module::isAvailable('permissionmanager')) return; diff --git a/modules-available/baseconfig/inc/baseconfigutil.inc.php b/modules-available/baseconfig/inc/baseconfigutil.inc.php index 4d1ef8c1..b4d7deeb 100644 --- a/modules-available/baseconfig/inc/baseconfigutil.inc.php +++ b/modules-available/baseconfig/inc/baseconfigutil.inc.php @@ -40,7 +40,7 @@ class BaseConfigUtil /** * Get configuration categories for given module, or all modules if false is passed. */ - public static function getCategories(Module $module = null): array + public static function getCategories(?Module $module = null): array { $categories = array(); if ($module === null) { diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php index 11a542ef..8f83f196 100644 --- a/modules-available/dozmod/api.inc.php +++ b/modules-available/dozmod/api.inc.php @@ -222,7 +222,7 @@ function outputLectureXmlForLocation(array $locationIds) return getListForLocations($locationIds, true); } -function _getVmData(string $lecture_uuid, string $subResource = null, string $cowUser = null) +function _getVmData(string $lecture_uuid, ?string $subResource = null, ?string $cowUser = null) { $url = VMX_URL . '/' . $lecture_uuid; if ($subResource !== null) { diff --git a/modules-available/exams/page.inc.php b/modules-available/exams/page.inc.php index c4f807c4..8787f498 100644 --- a/modules-available/exams/page.inc.php +++ b/modules-available/exams/page.inc.php @@ -103,7 +103,7 @@ class Page_Exams extends Page } // returns true if user is allowed to edit the exam - protected function userCanEditExam(string $examid = NULL): bool + protected function userCanEditExam(?string $examid = null): bool { if (in_array(0, $this->userEditLocations)) // Trivial case -- don't query if global perms return true; diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index 7c301f86..1a3bd76e 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -39,7 +39,7 @@ function HandleParameters() $output = Location::getTree(...$locationIds); } elseif ($get === "calendar") { $locationIds = LocationInfo::getLocationsOr404($uuid); - $output = LocationInfo::getCalendar($locationIds); + $output = LocationInfo::getCalendar($locationIds, time() + 3); } elseif ($get === "manifest") { $output = generateManifest($uuid); } diff --git a/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpNtlm/SoapClient.php b/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpNtlm/SoapClient.php index 98f23dfa..d1097d6e 100644 --- a/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpNtlm/SoapClient.php +++ b/modules-available/locationinfo/exchange-includes/jamesiarmes/PhpNtlm/SoapClient.php @@ -46,7 +46,7 @@ class SoapClient extends \SoapClient * characters are stripped. This has no affect unless strip_bad_chars is * true. */ - public function __construct($wsdl, array $options = null) + public function __construct($wsdl, ?array $options = null) { // Set missing indexes to their default value. $options += array( diff --git a/modules-available/locationinfo/inc/icalparser.inc.php b/modules-available/locationinfo/inc/icalparser.inc.php index 5b75de5f..208a7344 100644 --- a/modules-available/locationinfo/inc/icalparser.inc.php +++ b/modules-available/locationinfo/inc/icalparser.inc.php @@ -1752,12 +1752,9 @@ class ICalParser * problem for events on, during, or after 29 Jan 2038. * See https://en.wikipedia.org/wiki/Unix_time#Representing_the_number * - * @param string|null $rangeStart - * @param string|null $rangeEnd - * @return array * @throws Exception */ - public function eventsFromRange(string $rangeStart = null, string $rangeEnd = null): array + public function eventsFromRange(?string $rangeStart = null, ?string $rangeEnd = null): array { // Sort events before processing range $events = $this->sortEventsWithOrder($this->events()); diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 72c2c167..92ce03eb 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -1019,7 +1019,7 @@ class Page_LocationInfo extends Page * @param string|array $panelOrUuid UUID of panel, or array with keys paneltype and locationds * @param int[] $additionalLocations */ - private function assertPanelPermission($panelOrUuid, string $permission, array $additionalLocations = null): void + private function assertPanelPermission($panelOrUuid, string $permission, ?array $additionalLocations = null): void { if (is_array($panelOrUuid)) { $panel = $panelOrUuid; diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php index 6857482d..480d2fe9 100644 --- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php +++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php @@ -62,7 +62,7 @@ class RebootControl /** * Add wake task metadata to database, so we can display job details on the summary page. */ - private static function addTask(string $taskId, string $type, array $clients, array $other = null): void + private static function addTask(string $taskId, string $type, array $clients, ?array $other = null): void { $lids = ArrayUtil::flattenByKey($clients, 'locationid'); $lids = array_unique($lids); @@ -93,7 +93,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, string $id = null) + public static function getActiveTasks(?array $locations = null, ?string $id = null) { if (is_array($locations) && in_array(0, $locations)) { $locations = null; @@ -218,7 +218,7 @@ class RebootControl * Wake clients given by MAC address(es) via jawol util. * Multiple MAC addresses can be passed as a space separated list. */ - private static function buildClientWakeCommand(string $macs, string $bcast = null, string $passwd = null): string + private static function buildClientWakeCommand(string $macs, ?string $bcast = null, ?string $passwd = null): string { $command = 'jawol'; if (!empty($bcast)) { @@ -240,7 +240,7 @@ class RebootControl * @param string $passwd optional WOL password, mac address or ipv4 notation * @return array|false task struct, false on error */ - public static function wakeViaClient(array $sourceMachines, string $macaddr, string $bcast = null, string $passwd = null) + public static function wakeViaClient(array $sourceMachines, string $macaddr, ?string $bcast = null, ?string $passwd = null) { $command = self::buildClientWakeCommand($macaddr, $bcast, $passwd); // Yes there is one zero "missing" from the usleep -- that's the whole point: we prefer 100ms sleeps @@ -254,7 +254,7 @@ class RebootControl * @param ?string $passwd optional WOL password; mac address or ipv4 notation * @return array|false task struct, false on error */ - public static function wakeDirectly($macaddr, string $bcast = null, string $passwd = null) + public static function wakeDirectly($macaddr, ?string $bcast = null, ?string $passwd = null) { if (!is_array($macaddr)) { $macaddr = [$macaddr]; @@ -310,7 +310,7 @@ class RebootControl * @param ?array $failed list of failed clients from $clientList * @return ?string taskid of this job */ - public static function wakeMachines(array $clientList, array &$failed = null): ?string + public static function wakeMachines(array $clientList, ?array &$failed = null): ?string { $errors = ''; $sent = $unknown = $unreachable = $failed = []; @@ -446,7 +446,7 @@ class RebootControl $subnet['iclients'] = array_slice($subnet['iclients'], 0, 3); } - public static function prepareExec(string $presetId = null) + public static function prepareExec(?string $presetId = null) { User::assertPermission('.rebootcontrol.action.exec'); $uuids = array_values(Request::post('uuid', Request::REQUIRED, 'array')); diff --git a/modules-available/rebootcontrol/inc/scheduler.inc.php b/modules-available/rebootcontrol/inc/scheduler.inc.php index 19a01beb..a361825f 100644 --- a/modules-available/rebootcontrol/inc/scheduler.inc.php +++ b/modules-available/rebootcontrol/inc/scheduler.inc.php @@ -175,7 +175,7 @@ class Scheduler * @param string|null $onlyRunmode if not null, only process running clients in given runmode * @return void */ - private static function executeCronForLocation(int $locationId, string $action, string $onlyRunmode = null) + private static function executeCronForLocation(int $locationId, string $action, ?string $onlyRunmode = null) { if ($onlyRunmode === null) { $machines = Database::queryAll("SELECT machineuuid, clientip, macaddr, locationid FROM machine diff --git a/modules-available/roomplanner/inc/pvsgenerator.inc.php b/modules-available/roomplanner/inc/pvsgenerator.inc.php index 7860f893..7a67c92f 100644 --- a/modules-available/roomplanner/inc/pvsgenerator.inc.php +++ b/modules-available/roomplanner/inc/pvsgenerator.inc.php @@ -78,7 +78,7 @@ class PvsGenerator */ public static function generateSvg(?int $locationId = null, ?string $highlightUuid = null, int $rotate = 0, float $scale = 1, - bool $links = false, array $present = null): ?string + bool $links = false, ?array $present = null): ?string { if ($locationId === null) { if ($highlightUuid === null) diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php index 2d676cae..b9530f87 100644 --- a/modules-available/runmode/inc/runmode.inc.php +++ b/modules-available/runmode/inc/runmode.inc.php @@ -193,7 +193,7 @@ class RunMode * @param bool|null $isClient true = return clients only, false = return non-clients only, null = return both * @return array all the entries from the table */ - public static function getAllClients(bool $withData = false, bool $isClient = null): array + public static function getAllClients(bool $withData = false, ?bool $isClient = null): array { $xtra = ''; if ($withData) { diff --git a/modules-available/serversetup-bwlp-ipxe/inc/scriptbuildergrub.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/scriptbuildergrub.inc.php index a02c5180..cb7655d5 100644 --- a/modules-available/serversetup-bwlp-ipxe/inc/scriptbuildergrub.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/inc/scriptbuildergrub.inc.php @@ -109,7 +109,7 @@ EOF; /** * Redirect to same URL, but add our extended params */ - private function redirect(string $key = null, string $value = null): string + private function redirect(?string $key = null, ?string $value = null): string { // Redirect to self with added parameters $urlfull = $this->getUrlFull($key, $value); diff --git a/modules-available/serversetup-bwlp-ipxe/inc/scriptbuilderipxe.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/scriptbuilderipxe.inc.php index 9421684f..ff01c388 100644 --- a/modules-available/serversetup-bwlp-ipxe/inc/scriptbuilderipxe.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/inc/scriptbuilderipxe.inc.php @@ -58,7 +58,7 @@ class ScriptBuilderIpxe extends ScriptBuilderBase /** * Redirect to same URL, but add our extended params */ - private function redirect(string $key = null, string $value = null): string + private function redirect(?string $key = null, ?string $value = null): string { // Redirect to self with added parameters $urlfull = $this->getUrlFull($hasExt, $key, $value); diff --git a/modules-available/statistics/inc/hardwarequery.inc.php b/modules-available/statistics/inc/hardwarequery.inc.php index 6b1b5043..74beaab8 100644 --- a/modules-available/statistics/inc/hardwarequery.inc.php +++ b/modules-available/statistics/inc/hardwarequery.inc.php @@ -13,7 +13,7 @@ class HardwareQuery * @param string $type hardware type form HardwareInfo * @param ?string $uuid If set, only return data for specific client */ - public function __construct(string $type, string $uuid = null, $connectedOnly = true) + public function __construct(string $type, ?string $uuid = null, bool $connectedOnly = true) { if ($connectedOnly) { $this->joins['mxhw_join'] = "INNER JOIN machine_x_hw mxhw ON (mxhw.hwid = shw.hwid AND mxhw.disconnecttime = 0)"; @@ -97,7 +97,7 @@ class HardwareQuery return $this->addColumn(false, $prop); } - public function addColumn(bool $global, string $prop, string $alias = null): HardwareQueryColumn + public function addColumn(bool $global, string $prop, ?string $alias = null): HardwareQueryColumn { return $this->columns[] = new HardwareQueryColumn($global, $prop, $alias); } diff --git a/modules-available/statistics/inc/hardwarequerycolumn.inc.php b/modules-available/statistics/inc/hardwarequerycolumn.inc.php index 01e32978..b0e60e5b 100644 --- a/modules-available/statistics/inc/hardwarequerycolumn.inc.php +++ b/modules-available/statistics/inc/hardwarequerycolumn.inc.php @@ -18,7 +18,7 @@ class HardwareQueryColumn return 't' . ++self::$id; } - public function __construct(bool $global, string $column, string $alias = null) + public function __construct(bool $global, string $column, ?string $alias = null) { $this->classId = ++self::$id; $this->global = $global; @@ -32,7 +32,7 @@ class HardwareQueryColumn * from HardwareQuery::buildQuery(). * @param string[] $groupConcat if column name is NOT in this array, add as distinct GROUP_CONCAT to column. */ - public function generate(array &$joins, array &$columns, array &$params, array $groupConcat = [], string $globalSrcTableAlias = null) + public function generate(array &$joins, array &$columns, array &$params, array $groupConcat = [], ?string $globalSrcTableAlias = null) { if ($this->global) { $srcTable = $globalSrcTableAlias ?? 'shw'; diff --git a/modules-available/statistics/inc/statistics.inc.php b/modules-available/statistics/inc/statistics.inc.php index c12f5be4..6515feb0 100644 --- a/modules-available/statistics/inc/statistics.inc.php +++ b/modules-available/statistics/inc/statistics.inc.php @@ -46,7 +46,7 @@ class Statistics * @param string $sort something like 'lastseen ASC' - not sanitized, don't pass user input! * @return Machine[] list of matches */ - public static function getMachinesByIp(string $ip, int $returnData, string $sort = null): array + public static function getMachinesByIp(string $ip, int $returnData, ?string $sort = null): array { $fields = self::initFields($returnData); diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php index 72b0cbf9..23b53471 100644 --- a/modules-available/statistics/inc/statisticsfilter.inc.php +++ b/modules-available/statistics/inc/statisticsfilter.inc.php @@ -68,7 +68,7 @@ abstract class StatisticsFilter * The HardwareQuery class should probably be extended/rewritten to be more versatile in * this regard. */ - public static function addHardwareJoin(array &$args, array &$joins, string $hwtype = null): string + public static function addHardwareJoin(array &$args, array &$joins, ?string $hwtype = null): string { $joins['mxhw'] = ' INNER JOIN machine_x_hw mxhw ON (mxhw.disconnecttime = 0 AND mxhw.machineuuid = m.machineuuid)'; $key = self::getNewKey('foo'); diff --git a/modules-available/sysconfig/addmodule.inc.php b/modules-available/sysconfig/addmodule.inc.php index 37f6e0da..95f97ad7 100644 --- a/modules-available/sysconfig/addmodule.inc.php +++ b/modules-available/sysconfig/addmodule.inc.php @@ -26,7 +26,7 @@ abstract class AddModule_Base * @param string $step name of class representing the current step * @param int $editId (optional) overwrite for the request parameter 'edit' */ - public static function setStep(string $step, int $editId = null): void + public static function setStep(string $step, ?int $editId = null): void { if (empty($step) || !class_exists($step) || get_parent_class($step) !== 'AddModule_Base') { Message::addError('invalid-action', $step); diff --git a/modules-available/sysconfig/inc/configmodule.inc.php b/modules-available/sysconfig/inc/configmodule.inc.php index 34970d0a..b5494866 100644 --- a/modules-available/sysconfig/inc/configmodule.inc.php +++ b/modules-available/sysconfig/inc/configmodule.inc.php @@ -165,7 +165,7 @@ abstract class ConfigModule * @param string $moduleType module type to get * @return ?ConfigModule[] The requested modules from DB, or null on error */ - public static function getAll(string $moduleType = null): ?array + public static function getAll(?string $moduleType = null): ?array { if ($moduleType === null) { $ret = Database::simpleQuery("SELECT moduleid, title, moduletype, filepath, contents, version, status, dateline FROM configtgz_module"); @@ -379,7 +379,7 @@ abstract class ConfigModule * true if generation succeeded (without using a task or within $timeoutMs) * false on error */ - public final function generate(bool $deleteOnError, string $parent = NULL, int $timeoutMs = 0) + public final function generate(bool $deleteOnError, ?string $parent = null, int $timeoutMs = 0) { if ($this->moduleId === 0 || empty($this->moduleTitle)) ErrorHandler::traceError('ConfigModule::generateAsync called on uninitialized/uninserted module!'); diff --git a/modules-available/sysconfig/inc/configmodulebaseldap.inc.php b/modules-available/sysconfig/inc/configmodulebaseldap.inc.php index 388b6268..e21c3904 100644 --- a/modules-available/sysconfig/inc/configmodulebaseldap.inc.php +++ b/modules-available/sysconfig/inc/configmodulebaseldap.inc.php @@ -11,7 +11,7 @@ abstract class ConfigModuleBaseLdap extends ConfigModule 'shareOther', 'shareHomeDrive', 'shareDomain', 'credentialPassthrough', 'mapping', 'genuid', 'ldapAttrMountOpts', 'shareHomeMountOpts', 'nohomewarn'); - public static function getMapping(array $config = null, ?bool &$empty = true): array + public static function getMapping(?array $config = null, ?bool &$empty = true): array { $list = array( ['name' => 'uid', 'field' => 'uid', 'ad' => 'sAMAccountName'], @@ -49,7 +49,7 @@ abstract class ConfigModuleBaseLdap extends ConfigModule * @param string|null $parent if not NULL, this will be the parent task of the launch-task * @return boolean|string false on error, id of task otherwise */ - public static function ldadp(string $command = 'start', $ids = false, string $parent = null) + public static function ldadp(string $command = 'start', $ids = false, ?string $parent = null) { if ($ids === false) { $ids = self::getActiveModuleIds(); diff --git a/modules-available/sysconfig/inc/ppd.inc.php b/modules-available/sysconfig/inc/ppd.inc.php index c28e0355..a7fc7acb 100644 --- a/modules-available/sysconfig/inc/ppd.inc.php +++ b/modules-available/sysconfig/inc/ppd.inc.php @@ -866,7 +866,7 @@ class Ppd return $this->error === null; } - public function addEmptyOption(string $settingName, string $option, string $translation = null, bool $prepend = true): bool + public function addEmptyOption(string $settingName, string $option, ?string $translation = null, ?bool $prepend = true): bool { if (!isset($this->settings[$settingName])) return false; diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php index 5f915782..a6914a8a 100644 --- a/modules-available/translation/page.inc.php +++ b/modules-available/translation/page.inc.php @@ -429,7 +429,7 @@ class Page_Translation extends Page * * @return array of array(tag => array of templates using that tag) */ - private function loadUsedTemplateTags(Module $module = null): array + private function loadUsedTemplateTags(?Module $module = null): array { if ($module === null) { $module = $this->module; @@ -459,7 +459,7 @@ class Page_Translation extends Page * @param \Module $module module in question, null to use the one being edited * @return array see above */ - private function loadUsedMessageTags(Module $module = null): array + private function loadUsedMessageTags(?Module $module = null): array { if ($module === null) { $module = $this->module; @@ -491,7 +491,7 @@ class Page_Translation extends Page * * @return array (<tagname> => (bool)required) */ - private function loadUsedModuleTags(Module $module = null): array + private function loadUsedModuleTags(?Module $module = null): array { if ($module === null) { $module = $this->module; @@ -581,7 +581,7 @@ class Page_Translation extends Page * @param Module $module the module to work with, defaults to the currently edited module * @return array{0: int, 1 :int} (missing, unused) */ - private function getModuleTemplateStatus(string $lang, array $tags, Module $module = null): array + private function getModuleTemplateStatus(string $lang, array $tags, ?Module $module = null): array { return $this->getModuleTranslationStatus($lang, 'template-tags', true, $tags, $module); } @@ -604,7 +604,7 @@ class Page_Translation extends Page } /** @return array{0: int, 1 :int} (missing, unused) */ - private function getModuleOtherFileStatus(string $lang, Module $module = null, array $byFile = null): array + private function getModuleOtherFileStatus(string $lang, ?Module $module = null, ?array $byFile = null): array { if ($module === null) { $module = $this->module; @@ -669,7 +669,7 @@ class Page_Translation extends Page * @param Module $module the module to work with, defaults to the currently edited module * @return array [missingCount, unusedCount] */ - private function getModuleTranslationStatus(string $lang, string $file, bool $fallback, array $tags, Module $module = null): array + private function getModuleTranslationStatus(string $lang, string $file, bool $fallback, array $tags, ?Module $module = null): array { if ($module === null) { $module = $this->module; |