From c0b41a43c75134da4615538b3043d08b2ecf6500 Mon Sep 17 00:00:00 2001 From: Anyon Date: Fri, 8 May 2026 16:14:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(runtime):=20=E7=A7=BB=E9=99=A4=20v8=20?= =?UTF-8?q?=E6=97=A7=E7=B1=BB=E5=90=8D=E6=98=A0=E5=B0=84=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 彻底移除 v8 重构分支中遗留的 class_alias 兼容映射,避免新架构继续依赖旧包拆分时期的类名入口。 主要内容: - 删除 System 公共引导中的 think\admin 旧模型与旧服务别名映射。 - 删除 Worker 公共引导中的 SystemQueue 与 ProcessService 旧别名映射。 - 删除 Worker HTTP 服务对 think\response\File 的运行时类映射。 - 增加架构边界测试,防止后续重新引入 class_alias 与旧仓库名。 --- .../tests/ArchitectureBoundaryTest.php | 2 ++ plugin/think-plugs-system/src/common.php | 17 ----------------- plugin/think-plugs-worker/src/common.php | 8 -------- .../src/service/HttpServer.php | 4 ---- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/plugin/think-library/tests/ArchitectureBoundaryTest.php b/plugin/think-library/tests/ArchitectureBoundaryTest.php index 3d04edc4e..6e57ff391 100644 --- a/plugin/think-library/tests/ArchitectureBoundaryTest.php +++ b/plugin/think-library/tests/ArchitectureBoundaryTest.php @@ -396,6 +396,8 @@ class ArchitectureBoundaryTest extends TestCase 'plugin\wemall\integration\\', 'plugin\wuma\Query', 'plugin\wuma\Script', + 'class_' . 'alias(', + 'ThinkAdmin' . 'Developer', 'usession(', 'user_session_store', 'user_session_touch', diff --git a/plugin/think-plugs-system/src/common.php b/plugin/think-plugs-system/src/common.php index e71addf74..055348f98 100644 --- a/plugin/think-plugs-system/src/common.php +++ b/plugin/think-plugs-system/src/common.php @@ -32,23 +32,6 @@ if (!Container::getInstance()->bound(StorageManagerInterface::class) && class_ex Container::getInstance()->bind(StorageManagerInterface::class, StorageManager::class); } -foreach ([ - 'think\\admin\\model\\SystemAuth' => \plugin\system\model\SystemAuth::class, - 'think\\admin\\model\\SystemBase' => \plugin\system\model\SystemBase::class, - 'think\\admin\\model\\SystemFile' => \plugin\system\model\SystemFile::class, - 'think\\admin\\model\\SystemMenu' => \plugin\system\model\SystemMenu::class, - 'think\\admin\\model\\SystemNode' => \plugin\system\model\SystemNode::class, - 'think\\admin\\model\\SystemOplog' => \plugin\system\model\SystemOplog::class, - 'think\\admin\\model\\SystemUser' => \plugin\system\model\SystemUser::class, - 'think\\admin\\service\\AdminService' => \plugin\system\service\AuthService::class, - 'think\\admin\\service\\CaptchaService' => \plugin\system\service\CaptchaService::class, - 'think\\admin\\service\\MenuService' => \plugin\system\service\MenuService::class, - 'think\\admin\\service\\SystemService' => \plugin\system\service\SystemService::class, -] as $legacy => $target) { - if (!class_exists($legacy, false) && class_exists($target)) { - class_alias($target, $legacy); - } -} if (!function_exists('auth')) { /** diff --git a/plugin/think-plugs-worker/src/common.php b/plugin/think-plugs-worker/src/common.php index 7c447659f..4ef81bf88 100644 --- a/plugin/think-plugs-worker/src/common.php +++ b/plugin/think-plugs-worker/src/common.php @@ -20,14 +20,6 @@ declare(strict_types=1); use think\admin\Exception; use think\admin\service\QueueService; -foreach ([ - 'think\\admin\\model\\SystemQueue' => \plugin\worker\model\SystemQueue::class, - 'think\\admin\\service\\ProcessService' => \plugin\worker\service\ProcessService::class, -] as $legacy => $target) { - if (!class_exists($legacy, false) && class_exists($target)) { - class_alias($target, $legacy); - } -} if (!function_exists('sysqueue')) { /** diff --git a/plugin/think-plugs-worker/src/service/HttpServer.php b/plugin/think-plugs-worker/src/service/HttpServer.php index 9d2f145a1..579fb6a04 100644 --- a/plugin/think-plugs-worker/src/service/HttpServer.php +++ b/plugin/think-plugs-worker/src/service/HttpServer.php @@ -81,10 +81,6 @@ class HttpServer extends Server Http::class => ThinkHttp::class, ]); - if (!class_exists('think\response\File', false)) { - class_alias(ThinkResponseFile::class, 'think\response\File'); - } - RuntimeService::init($this->app)->initialize(); $this->app->http->warmup();