From 777d6b6c36e242ca6544062ec872162f9acbcbf8 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 9 Jul 2026 15:37:22 +0800 Subject: [PATCH] rename(project): refactor Swoole-Compiler to TypePHP - Rename project references from Swoole-Compiler to TypePHP in documentation - Update command line usage from php bin/compiler.php to ./tpc - Change application name constant from Swoole-Compiler (AOT) to TypePHP - Update file descriptions and metadata in project.yml - Modify Windows packaging script title to TypePHP - Replace all copyright headers to reference TypePHP instead of Swoole-Compiler --- .github/copilot-instructions.md | 8 ++++---- CLAUDE.md | 4 ++-- package-on-windows.php | 2 +- project.yml | 8 ++++---- src/Php/ArgInfo.php | 2 +- src/Php/AstNodeType.php | 2 +- src/Php/CompilerBase.php | 4 ++-- src/Php/CompilerTest.php | 2 +- src/Php/Constants.php | 2 +- src/Php/Extractor.php | 2 +- src/Php/FileScanner.php | 2 +- src/Php/MagicMethodDetector.php | 2 +- src/Php/Preprocessor.php | 2 +- src/Php/Reflection.php | 2 +- src/Php/Symbol.php | 2 +- src/Php/Translator.php | 4 ++-- src/Php/Visitor.php | 2 +- src/compiler.php | 4 ++-- src/functions.php | 2 +- src/polyfills.php | 2 +- 20 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 14ec8c0e..f8cf859e 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -2,7 +2,7 @@ ## Project overview -Swoole-Compiler is an AOT compiler that translates PHP source into C++, then compiles and links it into a native binary or a PHP extension. The primary entrypoint is `bin/compiler.php`, which boots `src/compiler.php`; that drives `PhpAot\Php\Translator` through a fixed pipeline: +TypePHP is an AOT compiler that translates PHP source into C++, then compiles and links it into a native binary or a PHP extension. The primary entrypoint is `tpc`, which boots `src/compiler.php`; that drives `PhpAot\Php\Translator` through a fixed pipeline: 1. `prepare()` scans files, parses ASTs, collects symbols, and topologically sorts PHP files by cross-file symbol usage. 2. `convert()` turns PHP ASTs into generated `.cc` files while passing through native source files (`.cpp`, `.c`, `.s`, `.m`, `.mm`). @@ -30,9 +30,9 @@ make -j32 Compile a project, directory, single file, or `project.yml`: ```bash -php bin/compiler.php -php bin/compiler.php -O2 -php bin/compiler.php --mode=ext -o +./tpc +./tpc -O2 +./tpc --mode=ext -o ``` ## Test commands diff --git a/CLAUDE.md b/CLAUDE.md index f3b46f15..017f5c65 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -Swoole-Compiler is an AOT (Ahead-of-Time) compiler that translates PHP source code to C++, then compiles it with GCC/Clang/MSVC into native binaries. It supports Linux (primary), macOS, and Windows. +TypePHP is an AOT (Ahead-of-Time) compiler that translates PHP source code to C++, then compiles it with GCC/Clang/MSVC into native binaries. It supports Linux (primary), macOS, and Windows. **Prerequisites**: PHP 8.2+, GCC 9+ (C++17), CMake 3.24+. The `swoole/phpx` extension must be compiled (see README.md). @@ -31,7 +31,7 @@ Example: PHP permits `return $value;` inside `__construct()` and lets callers co composer install # Compile a PHP project to a native binary -php bin/compiler.php +./tpc # Run all PHPUnit tests ./vendor/bin/phpunit diff --git a/package-on-windows.php b/package-on-windows.php index 07b77ada..5aabf623 100644 --- a/package-on-windows.php +++ b/package-on-windows.php @@ -13,7 +13,7 @@ if (PHP_OS_FAMILY !== 'Windows') { } echo "========================================\n"; -echo "Swoole Compiler Windows 打包脚本\n"; +echo "TypePHP Windows 打包脚本\n"; echo "========================================\n\n"; // ==================== 配置参数 ==================== diff --git a/project.yml b/project.yml index 1610e6a6..8dc03c5e 100644 --- a/project.yml +++ b/project.yml @@ -15,12 +15,12 @@ resource: file-version: 0.1.0.1052 product-version: 0.1.0 company-name: "上海识沃网络科技有限公司" - file-description: "Swoole AOT Compiler" - internal-name: "swoole-compiler" + file-description: "TypePHP Compiler" + internal-name: "typephp" legal-copyright: "Copyright (C) 2026 上海识沃网络科技有限公司" legal-trademarks: "Swoole is a trademark of 上海识沃网络科技有限公司" - original-filename: "swoole_compiler.exe" - product-name: "Swoole Compiler" + original-filename: "tpc.exe" + product-name: "TypePHP" comments: "PHP 原生编译器,可将 PHP 项目编译为 Windows/Linux/macOS 平台原生的可执行文件" # Windows 应用程序清单文件(缺省不携带 manifest) diff --git a/src/Php/ArgInfo.php b/src/Php/ArgInfo.php index 71ba32c3..af14b5fb 100644 --- a/src/Php/ArgInfo.php +++ b/src/Php/ArgInfo.php @@ -1,6 +1,6 @@ checkVarMustExist($node, $this->parseIdentifier($node)); $fn = $this->getChainedFunc($op); $expr = $node; diff --git a/src/Php/CompilerTest.php b/src/Php/CompilerTest.php index b8f5ed14..9adca885 100644 --- a/src/Php/CompilerTest.php +++ b/src/Php/CompilerTest.php @@ -1,6 +1,6 @@ = 2 && str_ends_with($argv[1], '.prof')) { profileAnalyze($argc, $argv); return; @@ -58,7 +58,7 @@ function profileAnalyze(int $argc, array $argv): void if (!file_exists($binary)) { fwrite(STDERR, "Binary not found: {$binary} (expected from prof file name)\n"); - fwrite(STDERR, "Usage: php bin/compiler.php .prof\n"); + fwrite(STDERR, "Usage: ./tpc .prof\n"); exit(1); } diff --git a/src/functions.php b/src/functions.php index 518db764..84ef2a8c 100644 --- a/src/functions.php +++ b/src/functions.php @@ -1,6 +1,6 @@