From 657d1d07843ec7eb7325304b2d742e9f150a2011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Fri, 10 Jan 2025 18:08:36 -0300 Subject: [PATCH] Remove the current_result global variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces it with a local variable. Signed-off-by: MaurĂ­cio Meneghini Fauth --- psalm-baseline.xml | 3 +-- src/Controllers/Table/ChangeController.php | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f41102eed7..81105c6ec9 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -2306,13 +2306,12 @@ - - + diff --git a/src/Controllers/Table/ChangeController.php b/src/Controllers/Table/ChangeController.php index 70a319cece..fbac03b894 100644 --- a/src/Controllers/Table/ChangeController.php +++ b/src/Controllers/Table/ChangeController.php @@ -54,8 +54,6 @@ class ChangeController implements InvocableController public function __invoke(ServerRequest $request): Response { - $GLOBALS['current_result'] ??= null; - $this->pageSettings->init('Edit'); $this->response->addHTML($this->pageSettings->getErrorHTML()); $this->response->addHTML($this->pageSettings->getHTML()); @@ -224,9 +222,7 @@ class ChangeController implements InvocableController InsertEdit::$pluginScripts = []; foreach ($rows as $rowId => $currentRow) { - $GLOBALS['current_result'] = is_array($result) && isset($result[$rowId]) - ? $result[$rowId] - : $result; + $currentResult = is_array($result) && isset($result[$rowId]) ? $result[$rowId] : $result; $repopulate = []; $checked = true; if (isset(self::$unsavedValues[$rowId])) { @@ -242,7 +238,7 @@ class ChangeController implements InvocableController UrlParams::$params, $tableColumns, $commentsMap, - $GLOBALS['current_result'], + $currentResult, $insertMode, $currentRow ?: [], $isUpload,