From 4b9d35919dd15467b17f9135a516271dd8b6b258 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Tue, 16 Dec 2025 09:25:54 +0100 Subject: [PATCH] fix(web): fix use warning in web updater Fix warnings when using web updater: > The use statement with non-compound name 'CurlHandle' has no effect Remove non-compound use when building web index.php Signed-off-by: Benjamin Gaussorgues [skip ci] --- Makefile | 2 +- tests/checkSameCodeBase.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e427aa6c..9e45d3ba 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ index.php: lib/UpdateException.php lib/LogException.php lib/Updater.php index.we # First put openining php tag and license awk '/^<\?php$$/,/\*\//' index.web.php > index.php # Then concat all files while filtering php tag and license - cat lib/UpdateException.php lib/LogException.php lib/Updater.php index.web.php| grep -v "^namespace" | awk '/^<\?php$$/,/\*\//{next} 1' >> index.php + cat lib/UpdateException.php lib/LogException.php lib/Updater.php index.web.php| grep -Pv "^namespace|^use [^\\\\]+;" | awk '/^<\?php$$/,/\*\//{next} 1' >> index.php test/vendor: composer bin tests install diff --git a/tests/checkSameCodeBase.php b/tests/checkSameCodeBase.php index 5beb9ca6..b65e0199 100644 --- a/tests/checkSameCodeBase.php +++ b/tests/checkSameCodeBase.php @@ -64,6 +64,7 @@ function findDiffPos($original, $copy) { $fileContent = file_get_contents($path); $fileContent = explode("namespace NC\\Updater;\n", $fileContent, 2)[1]; + $fileContent = preg_replace('/use [^\\\\]*;\n/', '', $fileContent); $fileContent = trim($fileContent);