From e8d2a7a77b05aadcf46bbde45811eb37bbc2a09c Mon Sep 17 00:00:00 2001 From: Yurun Date: Fri, 20 Oct 2023 14:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=9F=E5=BC=83=20imi-macro=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E5=87=BA=E4=B8=BB=E4=BB=93=E5=BA=93=20(#598)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpstan.yml | 5 - .github/workflows/rector.yml | 5 - .gitignore | 1 - .php-cs-fixer.php | 1 - dev/phpstan.sh | 1 - dev/rector.sh | 1 - doc/SUMMARY.md | 1 - doc/base/version/2.1-3.0.md | 4 + doc/components/macro.md | 118 ---------------- doc/components/phar/index.md | 4 +- phpstan-baseline/baseline-jwt.neon | 50 ------- phpstan-baseline/baseline-macro.neon | 2 - split-repository/release.php | 3 - split-repository/split.php | 3 - src/Bean/AnnotationParser.php | 4 - src/Components/jwt/composer.json | 3 +- src/Components/jwt/src/Bean/JWT.php | 12 -- src/Components/macro/.gitattributes | 10 -- src/Components/macro/.gitignore | 4 - src/Components/macro/LICENSE | 87 ------------ src/Components/macro/README.md | 52 ------- src/Components/macro/composer.json | 24 ---- src/Components/macro/rector.php | 5 - src/Components/macro/src/AutoLoader.php | 133 ------------------ .../macro/src/MacroComposerHook.php | 36 ----- src/Components/macro/src/Main.php | 14 -- src/Components/macro/src/bootstrap.php | 15 -- src/Components/phar/config/imi-phar-cfg.php | 2 +- src/Components/phar/src/PharService.php | 5 +- .../phar/tests/project/.imi-phar-cfg.php | 2 +- .../phar/tests/project/composer.json | 1 - src/Components/phar/tests/run-tests.php | 1 - .../src/HotUpdate/HotUpdateProcess.php | 1 - .../swoole/src/HotUpdate/HotUpdateProcess.php | 1 - .../src/HotUpdate/HotUpdateProcess.php | 1 - src/Util/File.php | 8 -- src/Util/Text.php | 6 - 37 files changed, 11 insertions(+), 615 deletions(-) delete mode 100644 doc/components/macro.md delete mode 100644 phpstan-baseline/baseline-macro.neon delete mode 100644 src/Components/macro/.gitattributes delete mode 100644 src/Components/macro/.gitignore delete mode 100644 src/Components/macro/LICENSE delete mode 100644 src/Components/macro/README.md delete mode 100644 src/Components/macro/composer.json delete mode 100644 src/Components/macro/rector.php delete mode 100644 src/Components/macro/src/AutoLoader.php delete mode 100644 src/Components/macro/src/MacroComposerHook.php delete mode 100644 src/Components/macro/src/Main.php delete mode 100644 src/Components/macro/src/bootstrap.php diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3023139d4a..07f31b8e4b 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -141,11 +141,6 @@ jobs: run: | docker exec ${ENV_SERVICE} ./dev/phpstan.sh workerman-gateway - - name: Analyse macro - if: ${{ env.test_prepared && always() }} - run: | - docker exec ${ENV_SERVICE} ./dev/phpstan.sh macro - - name: Analyse phar if: ${{ env.test_prepared && always() }} run: | diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 955aaab4ff..c1ccff2517 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -140,8 +140,3 @@ jobs: if: ${{ env.test_prepared && always() }} run: | docker exec -w /imi/src/Components/workerman-gateway ${ENV_SERVICE} /imi/vendor/bin/rector process --dry-run - - - name: Analyse macro - if: ${{ env.test_prepared && always() }} - run: | - docker exec -w /imi/src/Components/macro ${ENV_SERVICE} /imi/vendor/bin/rector process --dry-run diff --git a/.gitignore b/.gitignore index bf8016811a..69774d9b2c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ composer.lock /split-repository/vendor /.vscode *.pid -*.macro.php /.phpbench /node_modules /tests/clover.xml diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 9fe2ee3e6b..257f6c4c75 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -132,7 +132,6 @@ ->setFinder( PhpCsFixer\Finder::create() ->in(__DIR__) - ->notName('*.macro.php') ->notPath('src/Components/swoole/src/Util/Coroutine.typed.php') // 兼容 Swoole 5.0,需要 PHP >= 8.0 ->notPath('src/Components/hprose/src/Imi-Server-Hprose/Server.php') // bug: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/6534 ->notPath('src/Components/grpc/example/grpc') diff --git a/dev/phpstan.sh b/dev/phpstan.sh index be8db4ad1c..4b2d05e4dc 100755 --- a/dev/phpstan.sh +++ b/dev/phpstan.sh @@ -25,7 +25,6 @@ components=( "swoole-tracker" "workerman" "workerman-gateway" - "macro" ) analyze_component() { diff --git a/dev/rector.sh b/dev/rector.sh index edc07f9e5f..5bbda7e79c 100644 --- a/dev/rector.sh +++ b/dev/rector.sh @@ -25,7 +25,6 @@ components=( "swoole-tracker" "workerman" "workerman-gateway" - "macro" ) analyze_component() { diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md index 971073e743..e2924882a8 100644 --- a/doc/SUMMARY.md +++ b/doc/SUMMARY.md @@ -210,7 +210,6 @@ * [定时器](components/timer/index.md) * [异步执行](components/async/index.md) * [雪花算法发号器](components/snowflake.md) -* [宏定义](components/macro.md) * [Phar打包器](components/phar/index.md) * [imi 组件列表一览](components/list.md) * [PostgreSQL](components/db/pgsql.md) diff --git a/doc/base/version/2.1-3.0.md b/doc/base/version/2.1-3.0.md index 6f536d14b8..a12a2ecc9c 100644 --- a/doc/base/version/2.1-3.0.md +++ b/doc/base/version/2.1-3.0.md @@ -19,3 +19,7 @@ * `Imi\AMQP\Annotation\Connection` 注解类的连接配置全部废弃,只保留 `poolName` * 废弃 `Imi\AMQP\Swoole\AMQPSwooleConnection` 客户端类 + +### imi-macro + +废弃并移出主仓库,代码仓库: diff --git a/doc/components/macro.md b/doc/components/macro.md deleted file mode 100644 index d08a3c87c0..0000000000 --- a/doc/components/macro.md +++ /dev/null @@ -1,118 +0,0 @@ -# 宏定义 - -[toc] - -支持在 imi 框架中使用宏定义。 - -支持在 PHP 代码中使用类似 C/C++ 中的宏,进行代码预编译。 - -可以方便兼容不同版本和环境下运行的 PHP 代码。 - -在一些场景可以通过预定义常量,来提升性能,减少运行时判断。 - -本组件基于 [Yurunsoft/php-macro](https://github.com/Yurunsoft/php-macro) 组件,该组件由宇润主导开发。 - -> 这是 imi v2.1.0 引入的实验性新特性 - -## Composer - -本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 `composer.json` 中加入下面的内容: - -```json -{ - "require": { - "imiphp/imi-macro": "~3.0.0" - } -} -``` - -### 支持的宏 - -#### 文件格式 - -支持的文件名:`*.php`、`*.macro` - -**.php:** - -需要在文件中任意位置顶格加入代码: - -```php -# macro -``` - -> 该代码不加不生效 - -`A.php` 执行时,会在相同目录生成处理后的 `A.php.macro.php`。 - -**.macro:** - -需要创建同名的 `.php` 文件,如 `A.php`,内容为空即可。 - -再创建 `A.macro` 编写 PHP 代码。 - -执行时,会在相同目录生成处理后的 `A.macro.php`。 - -#### 常量 - -**宏:**`#define`、`#const`、`#ifdef`、`#ifndef` - -**例子:** - -```php -#ifndef IN_SWOOLE - # define IN_SWOOLE extension_loaded('swoole') -#endif -#ifdef IN_SWOOLE -#if IN_SWOOLE -\Co\run(function(){ - echo 'hello world'; -}); -#endif -#endif -``` - -> 注意:使用宏定义的常量,仅在生成代码时有效,运行时无效 - -#### 条件语句 - -**宏:**`#if`、`#else`、`#elif`、`#endif` - -**例子:** - -```php -=') -function test(): string|false -#else -/** - * @return string|false - */ -function test() -#endif -{ - return 'hello world'; -} -``` - -PHP >= 8.0 环境下生成的代码: - -```php - '*', @@ -225,7 +225,7 @@ return [ ### 内置过滤器(vendor) ```php -->notName(['/LICENSE|.*\\.md|.*\\.dist|Makefile/', '*.macro.php']) +->notName(['/LICENSE|.*\\.md|.*\\.dist|Makefile/']) ->exclude([ 'doc', 'test', diff --git a/phpstan-baseline/baseline-jwt.neon b/phpstan-baseline/baseline-jwt.neon index 3505a844e0..db99087d4d 100644 --- a/phpstan-baseline/baseline-jwt.neon +++ b/phpstan-baseline/baseline-jwt.neon @@ -60,56 +60,6 @@ parameters: count: 1 path: ../src/Components/jwt/src/Bean/JWT.php - - - message: "#^Call to an undefined method Lcobucci\\\\JWT\\\\Builder\\:\\:sign\\(\\)\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to an undefined method Lcobucci\\\\JWT\\\\Token\\:\\:validate\\(\\)\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to an undefined method Lcobucci\\\\JWT\\\\Token\\:\\:verify\\(\\)\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to method setAudience\\(\\) on an unknown class Lcobucci\\\\JWT\\\\ValidationData\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to method setId\\(\\) on an unknown class Lcobucci\\\\JWT\\\\ValidationData\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to method setIssuer\\(\\) on an unknown class Lcobucci\\\\JWT\\\\ValidationData\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Call to method setSubject\\(\\) on an unknown class Lcobucci\\\\JWT\\\\ValidationData\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Cannot instantiate interface Lcobucci\\\\JWT\\\\Builder\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Cannot instantiate interface Lcobucci\\\\JWT\\\\Parser\\.$#" - count: 2 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - - - message: "#^Instantiated class Lcobucci\\\\JWT\\\\ValidationData not found\\.$#" - count: 1 - path: ../src/Components/jwt/src/Bean/JWT.php.macro.php - - message: "#^Call to an undefined method Lcobucci\\\\JWT\\\\Token\\:\\:claims\\(\\)\\.$#" count: 1 diff --git a/phpstan-baseline/baseline-macro.neon b/phpstan-baseline/baseline-macro.neon deleted file mode 100644 index aab4991158..0000000000 --- a/phpstan-baseline/baseline-macro.neon +++ /dev/null @@ -1,2 +0,0 @@ -parameters: - ignoreErrors: [] diff --git a/split-repository/release.php b/split-repository/release.php index 32779b7939..f84041eaae 100644 --- a/split-repository/release.php +++ b/split-repository/release.php @@ -167,9 +167,6 @@ function getBranch(): string 'src/Components/roadrunner' => [ 'git@github.com:imiphp/imi-roadrunner', ], - 'src/Components/macro' => [ - 'git@github.com:imiphp/imi-macro', - ], 'src/Components/phar' => [ 'git@github.com:imiphp/imi-phar', ], diff --git a/split-repository/split.php b/split-repository/split.php index 81974616d8..26c712ddd4 100644 --- a/split-repository/split.php +++ b/split-repository/split.php @@ -186,9 +186,6 @@ function saveConfig(): void 'src/Components/roadrunner' => [ 'git@github.com:imiphp/imi-roadrunner', ], - 'src/Components/macro' => [ - 'git@github.com:imiphp/imi-macro', - ], 'src/Components/phar' => [ 'git@github.com:imiphp/imi-phar', ], diff --git a/src/Bean/AnnotationParser.php b/src/Bean/AnnotationParser.php index 05c812e309..260c78fa3e 100644 --- a/src/Bean/AnnotationParser.php +++ b/src/Bean/AnnotationParser.php @@ -1,7 +1,5 @@ getReader()->getClassAnnotations($ref); - # if PHP_VERSION_ID >= 80000 if ( \PHP_VERSION_ID >= 80000 && $phpAnnotations = $this->getPHPClassAnnotations($ref)) @@ -137,7 +134,6 @@ public function parseClass(\ReflectionClass $ref): void $annotations = $phpAnnotations; } } - # endif foreach ($annotations as $i => $annotation) { if (!$annotation instanceof \Imi\Bean\Annotation\Base) diff --git a/src/Components/jwt/composer.json b/src/Components/jwt/composer.json index f854d470d2..8af29d8f1c 100644 --- a/src/Components/jwt/composer.json +++ b/src/Components/jwt/composer.json @@ -17,8 +17,7 @@ "Imi\\JWT\\Test\\": "tests/" }, "files": [ - "../../../vendor/autoload.php", - "../macro/vendor/autoload.php" + "../../../vendor/autoload.php" ] }, "scripts": {}, diff --git a/src/Components/jwt/src/Bean/JWT.php b/src/Components/jwt/src/Bean/JWT.php index 4ef1088beb..a827556e51 100644 --- a/src/Components/jwt/src/Bean/JWT.php +++ b/src/Components/jwt/src/Bean/JWT.php @@ -1,7 +1,5 @@ 本仓库仅用于浏览,不接受 issue 和 Pull Requests,请前往: - -## Composer - -本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 `composer.json` 中加入下面的内容: - -```json -{ - "require": { - "imiphp/imi-macro": "~3.0.0" - } -} -``` - -然后执行 `composer update` 安装。 - -## 使用说明 - -参考: - -## 免费技术支持 - -QQ群:17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png "点击加群")](https://jq.qq.com/?_wv=1027&k=5wXf4Zq),如有问题会有人解答和修复。 - -## 运行环境 - -- [PHP](https://php.net/) >= 8.1 -- [Composer](https://getcomposer.org/) >= 2.0 -- [Swoole](https://www.swoole.com/) >= 5.0.0 - -## 版权信息 - -`imi-macro` 遵循 MulanPSL-2.0 开源协议发布,并提供免费使用。 - -## 捐赠 - - - -开源不求盈利,多少都是心意,生活不易,随缘随缘…… diff --git a/src/Components/macro/composer.json b/src/Components/macro/composer.json deleted file mode 100644 index bf62a004da..0000000000 --- a/src/Components/macro/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "imiphp/imi-macro", - "type": "library", - "license": "MulanPSL-2.0", - "description": "支持在 imi 框架中使用宏定义", - "require": { - "yurunsoft/macro": "~1.0.0" - }, - "autoload": { - "psr-4": { - "Imi\\Macro\\": "src/" - }, - "files": [ - "src/bootstrap.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Imi\\Macro\\Test\\": "tests/" - } - }, - "minimum-stability": "dev", - "prefer-stable": true -} \ No newline at end of file diff --git a/src/Components/macro/rector.php b/src/Components/macro/rector.php deleted file mode 100644 index 5e23e0976d..0000000000 --- a/src/Components/macro/rector.php +++ /dev/null @@ -1,5 +0,0 @@ -composerClassLoader->setClassMapAuthoritative(false); - } - $this->hasSwoole = \defined('SWOOLE_VERSION'); - $this->lockFileDir = getenv('IMI_MACRO_LOCK_FILE_DIR') ?: ''; - $this->outputDir = getenv('IMI_MACRO_OUTPUT_DIR') ?: ''; - } - - /** - * @return mixed - */ - public function __call(string $name, array $arguments) - { - return $this->composerClassLoader->{$name}(...$arguments); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if (str_starts_with($class, 'Yurun\Macro\\')) - { - return $this->composerClassLoader->loadClass($class); - } - $fileName = $this->composerClassLoader->findFile($class); - if (false === $fileName) - { - return null; - } - if ($this->loadingCount || ($this->hasSwoole && Coroutine::getCid() >= 1)) - { - if (1 === (++$this->loadingCount)) - { - $this->lastHookFlags = $flags = \Swoole\Runtime::getHookFlags(); - \Swoole\Runtime::setHookFlags($flags & ~(\SWOOLE_HOOK_FILE | \SWOOLE_HOOK_STDIO)); - } - try - { - $this->includeFile($fileName); - } - finally - { - if (0 === (--$this->loadingCount)) - { - \Swoole\Runtime::setHookFlags($this->lastHookFlags); - } - } - } - else - { - $this->includeFile($fileName); - } - - return true; - } - - private function includeFile(string $fileName): void - { - $macroFileName = $fileName . '.macro'; - if (file_exists($macroFileName)) - { - if ('' === $this->outputDir) - { - MacroParser::includeFile($macroFileName, $macroFileName . '.php', false, $this->lockFileDir); - } - else - { - MacroParser::includeFile($macroFileName, $this->outputDir . \DIRECTORY_SEPARATOR . md5($macroFileName) . '.php', false, $this->lockFileDir); - } - } - elseif (preg_match('/^\s*#\s*macro$/mUS', file_get_contents($fileName) ?: '')) - { - if ('' === $this->outputDir) - { - MacroParser::includeFile($fileName, $fileName . '.macro.php', false, $this->lockFileDir); - } - else - { - MacroParser::includeFile($fileName, $this->outputDir . \DIRECTORY_SEPARATOR . md5($macroFileName) . '.php', false, $this->lockFileDir); - } - } - else - { - includeFile($fileName); - } - } - - public function getComposerClassLoader(): ClassLoader - { - return $this->composerClassLoader; - } -} diff --git a/src/Components/macro/src/MacroComposerHook.php b/src/Components/macro/src/MacroComposerHook.php deleted file mode 100644 index 7ee7a6bada..0000000000 --- a/src/Components/macro/src/MacroComposerHook.php +++ /dev/null @@ -1,36 +0,0 @@ - '*', diff --git a/src/Components/phar/src/PharService.php b/src/Components/phar/src/PharService.php index 9b8baef460..b0f435506e 100644 --- a/src/Components/phar/src/PharService.php +++ b/src/Components/phar/src/PharService.php @@ -396,7 +396,6 @@ protected function filesProvider(): \Generator $finder->ignoreVCS(true); $finder->notName(Constant::CFG_FILE_NAME); - $finder->notName('*.macro.php'); if ($this->hasBootstrapFile) { $finder->notName($this->bootstrap); @@ -423,7 +422,7 @@ protected function filesProvider(): \Generator $finder = (new Finder()) ->files() ->in($this->baseDir) - ->name(['*.php', '*.macro', 'composer.json']) + ->name(['*.php', 'composer.json']) ->depth('== 0') ->ignoreDotFiles(true) ->ignoreVCS(true); @@ -466,7 +465,7 @@ protected function vendorProvider(): \Generator ->in($this->baseDir . \DIRECTORY_SEPARATOR . 'vendor') ->ignoreVCS(true); - $finder->notName(['/LICENSE|.*\\.md|.*\\.dist|Makefile/', '*.macro.php']); + $finder->notName(['/LICENSE|.*\\.md|.*\\.dist|Makefile/']); $finder->exclude([ 'doc', 'test', diff --git a/src/Components/phar/tests/project/.imi-phar-cfg.php b/src/Components/phar/tests/project/.imi-phar-cfg.php index 07207cc3c0..93e3c9da5b 100644 --- a/src/Components/phar/tests/project/.imi-phar-cfg.php +++ b/src/Components/phar/tests/project/.imi-phar-cfg.php @@ -9,7 +9,7 @@ // 参与打包的文件 // 可选值: - // - '*'自动包含根目录下的 *.php、*.macro 文件。(默认) + // - '*'自动包含根目录下的 *.php 文件。(默认) // - 空数组不包含任何文件。 // - 定义数组并填入文件名(仅限于当前目录下的文件)。 'files' => '*', diff --git a/src/Components/phar/tests/project/composer.json b/src/Components/phar/tests/project/composer.json index 529182d265..a41ef74583 100644 --- a/src/Components/phar/tests/project/composer.json +++ b/src/Components/phar/tests/project/composer.json @@ -5,7 +5,6 @@ "require": { "php": ">=8.1", "imiphp/imi": "3.0.9999", - "imiphp/imi-macro": "3.0.9999", "imiphp/imi-workerman": "3.0.9999", "imiphp/imi-swoole": "3.0.9999", "imiphp/imi-roadrunner": "3.0.9999" diff --git a/src/Components/phar/tests/run-tests.php b/src/Components/phar/tests/run-tests.php index 312db67dfe..b636f3f217 100644 --- a/src/Components/phar/tests/run-tests.php +++ b/src/Components/phar/tests/run-tests.php @@ -12,7 +12,6 @@ const LOCAL_REPOSITORIES = [ 'imiphp/imi' => '', - 'imiphp/imi-macro' => 'src/Components/macro', 'imiphp/imi-swoole' => 'src/Components/swoole', 'imiphp/imi-workerman' => 'src/Components/workerman', 'imiphp/imi-roadrunner' => 'src/Components/roadrunner', diff --git a/src/Components/roadrunner/src/HotUpdate/HotUpdateProcess.php b/src/Components/roadrunner/src/HotUpdate/HotUpdateProcess.php index 8cba7fa575..499eab258c 100644 --- a/src/Components/roadrunner/src/HotUpdate/HotUpdateProcess.php +++ b/src/Components/roadrunner/src/HotUpdate/HotUpdateProcess.php @@ -96,7 +96,6 @@ public function run(): void $this->defaultPath = Imi::getNamespacePaths(App::getNamespace()); } $this->excludePaths[] = Imi::getRuntimePath(); - $this->excludePaths[] = '*.macro.php'; Log::info('Process [hotUpdate] start'); $monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths); $time = 0; diff --git a/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php b/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php index 63e798b76a..683a4d19cf 100644 --- a/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php +++ b/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php @@ -120,7 +120,6 @@ public function run(\Swoole\Process $process): void $this->defaultPath = Imi::getNamespacePaths(App::getNamespace()); } $this->excludePaths[] = Imi::getRuntimePath(); - $this->excludePaths[] = '*.macro.php'; Log::info('Process [hotUpdate] start'); $monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths); $time = 0; diff --git a/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php b/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php index de881dc54f..5059458708 100644 --- a/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php +++ b/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php @@ -100,7 +100,6 @@ public function run(Worker $worker): void $this->defaultPath = Imi::getNamespacePaths(App::getNamespace()); } $this->excludePaths[] = Imi::getRuntimePath(); - $this->excludePaths[] = '*.macro.php'; Log::info('Process [hotUpdate] start'); $monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths); $time = 0; diff --git a/src/Util/File.php b/src/Util/File.php index cd04b61a13..d4cbb74561 100644 --- a/src/Util/File.php +++ b/src/Util/File.php @@ -1,7 +1,5 @@ -1) @@ -97,18 +94,13 @@ public static function enumFile(string $dirPath, ?string $pattern = null, array } else { - # endif - $result = self::enumFileSync($dirPath, $pattern, $extensionNames); yield from $result; if (false === $result->getReturn()) { return false; } - - # if \extension_loaded('swoole') } - # endif } /** diff --git a/src/Util/Text.php b/src/Util/Text.php index 91b1565fea..6c24a4a44e 100644 --- a/src/Util/Text.php +++ b/src/Util/Text.php @@ -1,7 +1,5 @@ = 80000) { return str_ends_with($string, $compare); } else { - # endif return $compare === strrchr($string, $compare); // @codeCoverageIgnore - # if \PHP_VERSION_ID < 80000 } - # endif } else {