mirror of
http://124.126.16.154:8888/singularity/hyperf-admin.git
synced 2026-01-15 03:35:07 +08:00
- 将多个匿名函数改为箭头函数以提高可读性 - 修复部分变量类型不匹配的问题,增加类型转换 - 删除冗余的代码和注释,简化逻辑 - 更新数据库操作相关代码,提高安全性 - 优化数组处理和字符串操作方法 - 统一代码风格,提升整体代码质量
30 lines
1001 B
PHP
30 lines
1001 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
// rector.php
|
|
use Rector\Config\RectorConfig;
|
|
use Rector\Set\ValueObject\LevelSetList;
|
|
use Rector\Set\ValueObject\SetList;
|
|
|
|
return static function (RectorConfig $rectorConfig): void {
|
|
// 1. 定义需要扫描的文件/目录
|
|
$rectorConfig->paths([
|
|
__DIR__ . '/src', // 替换为你项目代码的路径,例如:/app, /backend 等
|
|
// __DIR__ . '/tests', // 如果你想升级测试代码,也加入
|
|
]);
|
|
|
|
// 2. 一次性应用所有规则到 PHP 8.2 (推荐用于大型升级)
|
|
$rectorConfig->sets([
|
|
// 这将包含从 7.4 到 8.1 的所有升级规则,以及 8.2 的所有新规则
|
|
LevelSetList::UP_TO_PHP_82,
|
|
// 建议同时加入一些代码质量改进的规则
|
|
SetList::DEAD_CODE, // 移除无用代码
|
|
]);
|
|
|
|
// 可选:跳过某些文件或规则
|
|
// $rectorConfig->skip([
|
|
// // 例如:跳过特定文件
|
|
// // __DIR__ . '/src/Legacy/old_file.php',
|
|
// ]);
|
|
}; |