跳至内容
3.2 升级指南

3.2 升级指南

  • 3.2 版本主要修改了 PHP 最低版本为 8.2
  • 升级 symfony/* 组件至支持 ^6.0 || ^7.0
  • 升级 phpunit/phpunit^11.0

不兼容变更

  1. async-queue 组件将 JobInterface::getQueueName() 重命名为 getPoolName()
<?php
// 变更前
class CustomJob extends \Hyperf\AsyncQueue\Job
{
    public function getQueueName(): string
    {
        return 'custom';
    }
}

// 变更后
class CustomJob extends \Hyperf\AsyncQueue\Job
{
    public function getPoolName(): string
    {
        return 'custom';
    }
}
  1. logger 配置结构已变更。请参考 #7563

  2. cache 配置结构已变更。请参考 #7594

  3. 使用 swow 时,需要新增 response emitter 依赖。

<?php
// config/autoload/dependencies.php

use Hyperf\Contract\ResponseEmitterInterface;
use Hyperf\Engine\ResponseEmitter;

return [
    ResponseEmitterInterface::class => ResponseEmitter::class,
];

依赖升级

  • 升级 php 版本至 >=8.2
  • 升级 elasticsearch/elasticsearch^8.0 || ^9.0
  • 升级 nikic/php-parser5.6
  • 升级 symfony/* 组件至 ^6.0 || ^7.0
  • 升级 phpunit/phpunit^11.0
  • 升级 google/protobuf^3.6.1 || ^4.2
  • 升级 guzzlehttp/guzzle^7.0

注意

如果你已经升级到 PHP 8.4,fgetcsvfputcsv 方法现在都需要为 escape 参数提供默认值。

fputcsv($fp, $fields, escape: '');
fgetcsv($fp, escape: '');