From 7681f6dc26de630a717778255f15defe1cbcb8c5 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 25 Mar 2026 17:41:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(php):=20=E4=BF=AE=E5=A4=8D=E9=A2=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=99=A8=E4=B8=AD=E7=9A=84=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在符号依赖检查中添加文件过滤条件,避免将当前文件添加到依赖列表中 - 移除对函数节点类型的冗余检查,简化符号声明文件映射逻辑 - 确保所有符号声明都能正确记录到对应文件中,提高依赖解析准确性 --- src/Php/Preprocessor.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Php/Preprocessor.php b/src/Php/Preprocessor.php index 123ec91c..84e1ea12 100644 --- a/src/Php/Preprocessor.php +++ b/src/Php/Preprocessor.php @@ -26,11 +26,15 @@ class Preprocessor extends CompilerBase $deps = []; foreach ($symbols as $symbol) { if (isset($this->symbolDeclInFile[$symbol])) { - $deps[] = $this->symbolDeclInFile[$symbol]; + $depFile = $this->symbolDeclInFile[$symbol]; + if ($depFile !== $file) { + $deps[] = $depFile; + } } } $sorter->add($file, array_unique($deps)); } + $sortedFiles = $sorter->sort(); foreach ($list as $file) { @@ -171,9 +175,7 @@ class Preprocessor extends CompilerBase if ($this->stubFile) { $this->nativeFunctions[$name] = $this->parseFunctionDecl($v); } else { - if ($v instanceof Node\Stmt\Function_) { - $this->symbolDeclInFile[strtolower($name)] = $this->file; - } + $this->symbolDeclInFile[strtolower($name)] = $this->file; } }