From 2b32209ae897477f3c968df057ef7419e6f954bc Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 10 Feb 2023 19:25:35 +0000 Subject: [PATCH] Remove useless references (#18058) * Remove useless references * Change out param to returning * Add missing type declarations * Update psalm-baseline.xml --------- Signed-off-by: Kamil Tekiela --- libraries/classes/Config/PageSettings.php | 31 +++++++++-------------- psalm-baseline.xml | 8 ------ 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/libraries/classes/Config/PageSettings.php b/libraries/classes/Config/PageSettings.php index 4baa399fef..fb71d33277 100644 --- a/libraries/classes/Config/PageSettings.php +++ b/libraries/classes/Config/PageSettings.php @@ -82,7 +82,7 @@ class PageSettings // Process form $error = null; if (isset($_POST['submit_save']) && $_POST['submit_save'] == $formGroupName) { - $this->processPageSettings($formDisplay, $cf, $error); + $error = $this->processPageSettings($formDisplay, $cf); } // Display forms @@ -92,14 +92,13 @@ class PageSettings /** * Process response to form * - * @param FormDisplay $formDisplay Form - * @param ConfigFile $cf Configuration file - * @param Message|null $error Error message + * @param FormDisplay $formDisplay Form + * @param ConfigFile $cf Configuration file */ - private function processPageSettings(&$formDisplay, &$cf, &$error): void + private function processPageSettings(FormDisplay $formDisplay, ConfigFile $cf): ?Message { if (! $formDisplay->process(false) || $formDisplay->hasErrors()) { - return; + return null; } // save settings @@ -111,7 +110,7 @@ class PageSettings exit; } - $error = $result; + return $result; } /** @@ -120,7 +119,7 @@ class PageSettings * @param FormDisplay $formDisplay Form * @param Message|null $error Error message */ - private function storeError(&$formDisplay, &$error): void + private function storeError(FormDisplay $formDisplay, ?Message $error): void { $retval = ''; if ($error) { @@ -141,12 +140,10 @@ class PageSettings /** * Display page-related settings * - * @param FormDisplay $formDisplay Form - * @param Message $error Error message - * - * @return string + * @param FormDisplay $formDisplay Form + * @param Message|null $error Error message */ - private function getPageSettingsDisplay(&$formDisplay, &$error) + private function getPageSettingsDisplay(FormDisplay $formDisplay, ?Message $error): string { $response = ResponseRenderer::getInstance(); @@ -165,20 +162,16 @@ class PageSettings /** * Get HTML output - * - * @return string */ - public function getHTML() + public function getHTML(): string { return $this->HTML; } /** * Get error HTML output - * - * @return string */ - public function getErrorHTML() + public function getErrorHTML(): string { return $this->errorHTML; } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3d332faa7b..83e0fcfd39 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -644,14 +644,6 @@ $result['Sql_queries'][] - - - $error - - - return $retval; - - $loginCookieValidity