From 1d6e7522ab001757794b1289f3e3026106f30bd4 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 4 Feb 2026 12:02:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor(php):=20=E5=B0=86PHP=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E7=A7=BB=E5=8A=A8=E5=88=B0Entity=E5=AD=90=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将ClassDef.php移至src/Php/Entity/ClassDef.php并更新命名空间 - 将ClassLikeDef.php移至src/Php/Entity/ClassLikeDef.php并更新命名空间 - 将ConstantDef.php移至src/Php/Entity/ConstantDef.php并更新命名空间 - 将FunctionDef.php移至src/Php/Entity/FunctionDef.php并更新命名空间 - 将InterfaceDef.php移至src/Php/Entity/InterfaceDef.php并更新命名空间 - 将MethodDef.php移至src/Php/Entity/MethodDef.php并更新命名空间 - 将PropertyDef.php移至src/Php/Entity/PropertyDef.php并更新命名空间 - 更新CompilerBase.php中的实体类引用路径 - 更新MagicMethodDetector.php中的MethodDef引用路径 - 更新Translator.php中的所有实体类引用路径 --- src/Php/CompilerBase.php | 5 +++++ src/Php/{ => Entity}/ClassDef.php | 2 +- src/Php/{ => Entity}/ClassLikeDef.php | 2 +- src/Php/{ => Entity}/ConstantDef.php | 2 +- src/Php/{ => Entity}/FunctionDef.php | 4 +++- src/Php/{ => Entity}/InterfaceDef.php | 2 +- src/Php/{ => Entity}/MethodDef.php | 2 +- src/Php/{ => Entity}/PropertyDef.php | 2 +- src/Php/MagicMethodDetector.php | 1 + src/Php/Translator.php | 7 +++++++ 10 files changed, 22 insertions(+), 7 deletions(-) rename src/Php/{ => Entity}/ClassDef.php (97%) rename src/Php/{ => Entity}/ClassLikeDef.php (96%) rename src/Php/{ => Entity}/ConstantDef.php (94%) rename src/Php/{ => Entity}/FunctionDef.php (91%) rename src/Php/{ => Entity}/InterfaceDef.php (91%) rename src/Php/{ => Entity}/MethodDef.php (95%) rename src/Php/{ => Entity}/PropertyDef.php (97%) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index d8739c5b..dc0774c8 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -9,6 +9,11 @@ namespace PhpAot\Php; use League\CLImate\CLImate; +use PhpAot\Php\Entity\ClassDef; +use PhpAot\Php\Entity\FunctionDef; +use PhpAot\Php\Entity\InterfaceDef; +use PhpAot\Php\Entity\MethodDef; +use PhpAot\Php\Entity\PropertyDef; use PhpAot\Php\Exception\Redo; use PhpAot\Php\Exception\Skip; use PhpParser\Modifiers; diff --git a/src/Php/ClassDef.php b/src/Php/Entity/ClassDef.php similarity index 97% rename from src/Php/ClassDef.php rename to src/Php/Entity/ClassDef.php index c767cb70..8018b8bc 100644 --- a/src/Php/ClassDef.php +++ b/src/Php/Entity/ClassDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; class ClassDef extends ClassLikeDef { diff --git a/src/Php/ClassLikeDef.php b/src/Php/Entity/ClassLikeDef.php similarity index 96% rename from src/Php/ClassLikeDef.php rename to src/Php/Entity/ClassLikeDef.php index 77390874..ade9c4b7 100644 --- a/src/Php/ClassLikeDef.php +++ b/src/Php/Entity/ClassLikeDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; class ClassLikeDef { diff --git a/src/Php/ConstantDef.php b/src/Php/Entity/ConstantDef.php similarity index 94% rename from src/Php/ConstantDef.php rename to src/Php/Entity/ConstantDef.php index dd546193..3c5d36f6 100644 --- a/src/Php/ConstantDef.php +++ b/src/Php/Entity/ConstantDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; class ConstantDef { diff --git a/src/Php/FunctionDef.php b/src/Php/Entity/FunctionDef.php similarity index 91% rename from src/Php/FunctionDef.php rename to src/Php/Entity/FunctionDef.php index 51adf5b8..e6bf0875 100644 --- a/src/Php/FunctionDef.php +++ b/src/Php/Entity/FunctionDef.php @@ -6,7 +6,9 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; + +use PhpAot\Php\ArgInfo; class FunctionDef { diff --git a/src/Php/InterfaceDef.php b/src/Php/Entity/InterfaceDef.php similarity index 91% rename from src/Php/InterfaceDef.php rename to src/Php/Entity/InterfaceDef.php index c263f09d..019b4e9f 100644 --- a/src/Php/InterfaceDef.php +++ b/src/Php/Entity/InterfaceDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; class InterfaceDef extends ClassLikeDef { diff --git a/src/Php/MethodDef.php b/src/Php/Entity/MethodDef.php similarity index 95% rename from src/Php/MethodDef.php rename to src/Php/Entity/MethodDef.php index a1ff7a0b..ce78aafd 100644 --- a/src/Php/MethodDef.php +++ b/src/Php/Entity/MethodDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; class MethodDef { diff --git a/src/Php/PropertyDef.php b/src/Php/Entity/PropertyDef.php similarity index 97% rename from src/Php/PropertyDef.php rename to src/Php/Entity/PropertyDef.php index 614ae7d4..e2160fc2 100644 --- a/src/Php/PropertyDef.php +++ b/src/Php/Entity/PropertyDef.php @@ -6,7 +6,7 @@ * @contact service@swoole.com */ -namespace PhpAot\Php; +namespace PhpAot\Php\Entity; use PhpParser\Modifiers; diff --git a/src/Php/MagicMethodDetector.php b/src/Php/MagicMethodDetector.php index 17b1ad24..e8cd4a19 100644 --- a/src/Php/MagicMethodDetector.php +++ b/src/Php/MagicMethodDetector.php @@ -8,6 +8,7 @@ namespace PhpAot\Php; +use PhpAot\Php\Entity\MethodDef; use PhpParser\NodeAbstract; trait MagicMethodDetector diff --git a/src/Php/Translator.php b/src/Php/Translator.php index fa857cdd..00dfe27f 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -9,6 +9,13 @@ namespace PhpAot\Php; use MJS\TopSort\Implementations\StringSort; +use PhpAot\Php\Entity\ClassDef; +use PhpAot\Php\Entity\ClassLikeDef; +use PhpAot\Php\Entity\ConstantDef; +use PhpAot\Php\Entity\FunctionDef; +use PhpAot\Php\Entity\InterfaceDef; +use PhpAot\Php\Entity\MethodDef; +use PhpAot\Php\Entity\PropertyDef; use PhpAot\Php\Exception\Redo; use PhpParser\Modifiers; use PhpParser\Node;