From 3cc3c2287e26b6a51efd361824165ad8666122e2 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 --- Makefile | 2 +- index.php | 2 -- tests/checkSameCodeBase.php | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 45bbdf56..273f7e7c 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/index.php b/index.php index 2d630209..277bfa7e 100644 --- a/index.php +++ b/index.php @@ -27,8 +27,6 @@ class LogException extends \Exception { } -use Closure; -use CurlHandle; class Updater { /** @var int */ diff --git a/tests/checkSameCodeBase.php b/tests/checkSameCodeBase.php index 4e56830f..473c5e88 100644 --- a/tests/checkSameCodeBase.php +++ b/tests/checkSameCodeBase.php @@ -65,6 +65,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);