From 38e8bacd07c4dd7b9fb6aca3dc4479d65c864560 Mon Sep 17 00:00:00 2001 From: odain Date: Wed, 20 May 2026 06:57:45 +0200 Subject: [PATCH] code style only --- core/config.class.inc.php | 12 ++++++++---- data/.compilation-symlinks | 0 .../PhpParser/Evaluation/PhpExpressionEvaluator.php | 4 ++-- .../datamodels/2.x/itop-config/ConfigTest.php | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 data/.compilation-symlinks diff --git a/core/config.class.inc.php b/core/config.class.inc.php index fb7f1dc330..b211bda263 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -2748,9 +2748,11 @@ class Config fwrite($hFile, "\t'$sModule' => array (\n"); foreach ($aProperties as $sProperty => $value) { if (is_string($value) && false !== strpos($value, 'PhpParserComment')) { - $value = preg_replace(["/.*StartPhpParserComment/", "/EndPhpParserComment/"], + $value = preg_replace( + ["/.*StartPhpParserComment/", "/EndPhpParserComment/"], ['', ''], - $value); + $value + ); fwrite($hFile, "\t\t$value\n"); continue; } @@ -2941,9 +2943,11 @@ class Config $sExport = var_export($value, true); if (strpos($sExport, 'PhpParserComment')) { - $sExport = preg_replace(["/.*StartPhpParserComment/", "/EndPhpParserComment',/"], + $sExport = preg_replace( + ["/.*StartPhpParserComment/", "/EndPhpParserComment',/"], ['', ''], - $sExport); + $sExport + ); } $sNiceExport = str_replace(["\r\n", "\n", "\r"], "\n".$sIndentation, trim($sExport)); if (!$bForceIndentation) { diff --git a/data/.compilation-symlinks b/data/.compilation-symlinks deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/sources/PhpParser/Evaluation/PhpExpressionEvaluator.php b/sources/PhpParser/Evaluation/PhpExpressionEvaluator.php index 33292baaa7..caad64bbc4 100644 --- a/sources/PhpParser/Evaluation/PhpExpressionEvaluator.php +++ b/sources/PhpParser/Evaluation/PhpExpressionEvaluator.php @@ -61,10 +61,10 @@ PHP; public function GetArrayWithComments(Array_ $oArray): array { $aRes = []; - $i=0; + $i = 0; foreach ($oArray->items as $oItem) { /** @var \PhpParser\Node\ArrayItem $oItem **/ - if(is_null($oItem->key)){ + if (is_null($oItem->key)) { $sKey = $i; $i++; } else { diff --git a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php index c1c8b16fac..6439867f39 100644 --- a/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php +++ b/tests/php-unit-tests/unitary-tests/datamodels/2.x/itop-config/ConfigTest.php @@ -103,8 +103,9 @@ class ConfigTest extends ItopTestCase $this->assertEquals($this->GetModuleSettingSection($sConfigFile), $this->GetModuleSettingSection($sTmpFile)); } - private function GetModuleSettingSection(string $sFilePath) : string { + private function GetModuleSettingSection(string $sFilePath): string + { preg_match('/\$MyModuleSettings[\w\W]*\/\*\*/m', file_get_contents($sFilePath), $aMatches); - return preg_replace(['/[ ]+/', '/[ ]+/'],[' ', ' '], $aMatches[0]); + return preg_replace(['/[ ]+/', '/[ ]+/'], [' ', ' '], $aMatches[0]); } }