From 8f3f3e73eb643e8c15a65e1f45f151dfe2ef6ee5 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 18 Jun 2026 14:08:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(php):=20=E7=AE=80=E5=8C=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=E8=AF=BB=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除对下划线格式配置键的支持,统一使用中横线格式 - 更新 cxx-flags 配置项读取方式 - 更新 cxx-std 配置项读取方式 - 更新 ld-flags 配置项读取方式 - 更新 link-libs 配置项读取方式 - 更新 link-paths 配置项读取方式 - 更新 cpp-compiler 配置项读取方式 --- src/Php/Translator.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Php/Translator.php b/src/Php/Translator.php index 9f0d7ef9..4a01ea6d 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -1865,8 +1865,8 @@ CODE; $list = $this->getFilesFromDir($projectDir); } - // 读取 cxx-flags(支持中横线和下划线) - $cxxFlags = $cfg['cxx-flags'] ?? $cfg['cxxflags'] ?? null; + // 读取 cxx-flags + $cxxFlags = $cfg['cxx-flags'] ?? null; if (!empty($cxxFlags)) { if (is_array($cxxFlags)) { $this->cxxFlags = implode(' ', $cxxFlags); @@ -1875,14 +1875,14 @@ CODE; } } - // 读取 C++ 标准版本(支持中横线和下划线) - $cxxStd = $cfg['cxx-std'] ?? $cfg['cxx_std'] ?? null; + // 读取 cxx-std + $cxxStd = $cfg['cxx-std'] ?? null; if (!empty($cxxStd)) { $this->cxxStd = $cxxStd; } - // 读取 ldflags(支持中横线和下划线) - $ldflags = $cfg['ld-flags'] ?? $cfg['ldflags'] ?? null; + // 读取 ld-flags + $ldflags = $cfg['ld-flags'] ?? null; if (!empty($ldflags)) { if (is_array($ldflags)) { $this->ldflags = implode(' ', $ldflags); @@ -1891,16 +1891,16 @@ CODE; } } - // 读取 link-libs(支持中横线和下划线) - $linkLibs = $cfg['link-libs'] ?? $cfg['link_libs'] ?? null; + // 读取 link-libs + $linkLibs = $cfg['link-libs'] ?? null; if (!empty($linkLibs) && is_array($linkLibs)) { foreach ($linkLibs as $lib) { $this->linkLibs[] = (string)$lib; } } - // 读取 link-paths(支持中横线和下划线) - $linkPaths = $cfg['link-paths'] ?? $cfg['link_paths'] ?? null; + // 读取 link-paths + $linkPaths = $cfg['link-paths'] ?? null; if (!empty($linkPaths) && is_array($linkPaths)) { foreach ($linkPaths as $path) { $this->linkPaths[] = (string)$path; @@ -1912,8 +1912,8 @@ CODE; $this->setTargetName($cfg['name']); } - // 读取 cpp-compiler(支持中横线和下划线) - $cppCompiler = $cfg['cpp-compiler'] ?? $cfg['cpp_compiler'] ?? null; + // 读取 cpp-compiler + $cppCompiler = $cfg['cpp-compiler'] ?? null; if (!empty($cppCompiler)) { $this->setCppCompiler($cppCompiler); }