chore(deps): 升级 hyperf 框架依赖至 3.0 版本

- 将所有 hyperf 组件版本从 2.2.x 升级到 3.0.x
- 更新 singularity/hdk-core 依赖从0.1.6 到 1.0.0
- 移除 minimum-stability 配置项
- 添加 runtime 目录到 .gitignore
- 更新 RedisArray 类型提示和返回值
- 为监听器方法添加 void 返回类型
- 更新 ColorLineFormatter 的 LogRecord 类型提示
- 添加 hyperf.php 入口文件
This commit is contained in:
李东云
2025-09-28 09:41:31 +08:00
parent 606672b1d6
commit 4484fb1eea
9 changed files with 1880 additions and 580 deletions

View File

@@ -2,6 +2,7 @@
namespace HyperfAdmin\BaseUtils;
use Monolog\Formatter\LineFormatter;
use Monolog\LogRecord;
class ColorLineFormatter extends LineFormatter
{
@@ -11,7 +12,7 @@ class ColorLineFormatter extends LineFormatter
'WARNING' => "\e[0;33m{log_str}\e[0m",
];
public function format(array $record): string
public function format(LogRecord $record): string
{
$log = parent::format($record);

View File

@@ -15,7 +15,7 @@ class BootAppConfListener implements ListenerInterface
];
}
public function process(object $event)
public function process(object $event): void
{
Builder::macro('getAsArray', function () {
/** @var \Hyperf\Database\Query\Builder $this */

View File

@@ -15,7 +15,7 @@ class DbQueryExecutedListener implements ListenerInterface
];
}
public function process(object $event)
public function process(object $event): void
{
if($event instanceof QueryExecuted) {
if(is_production()) {

View File

@@ -15,7 +15,7 @@ class FetchModeListener implements ListenerInterface
];
}
public function process(object $event)
public function process(object $event): void
{
if($event instanceof StatementPrepared) {
$event->statement->setFetchMode(PDO::FETCH_ASSOC);

View File

@@ -16,12 +16,12 @@ class RedisArray implements \ArrayAccess
$this->redis = container(RedisFactory::class)->get($cluster);
}
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return $this->redis->hExists($this->name, (string)$offset);
}
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
$val = $this->redis->hGet($this->name, (string)$offset);
if(is_json_str($val)) {
@@ -31,14 +31,14 @@ class RedisArray implements \ArrayAccess
return $val;
}
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
return $this->redis->hSet($this->name, (string)$offset, is_array($value) ? json_encode($value) : $value);
$this->redis->hSet($this->name, (string)$offset, is_array($value) ? json_encode($value) : $value);
}
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
return $this->redis->hDel($this->name, (string)$offset);
$this->redis->hDel($this->name, (string)$offset);
}
public function __destruct()