Skip to content

Commit d2a5dd4

Browse files
authored
Upgrade the minimum php version to 8.0 for load-balancer and redis. (#4359)
1 parent f2cf1dd commit d2a5dd4

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/Driver/RedisDriver.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,29 @@
1717
use Hyperf\AsyncQueue\Message;
1818
use Hyperf\AsyncQueue\MessageInterface;
1919
use Hyperf\Redis\RedisFactory;
20+
use Hyperf\Redis\RedisProxy;
2021
use Psr\Container\ContainerInterface;
2122

2223
class RedisDriver extends Driver
2324
{
24-
/**
25-
* @var \Redis
26-
*/
27-
protected $redis;
25+
protected RedisProxy $redis;
2826

29-
/**
30-
* @var ChannelConfig
31-
*/
32-
protected $channel;
27+
protected ChannelConfig $channel;
3328

3429
/**
3530
* Max polling time.
36-
* @var int
3731
*/
38-
protected $timeout;
32+
protected int $timeout;
3933

4034
/**
4135
* Retry delay time.
42-
* @var array|int
4336
*/
44-
protected $retrySeconds;
37+
protected array|int $retrySeconds;
4538

4639
/**
4740
* Handle timeout.
48-
* @var int
4941
*/
50-
protected $handleTimeout;
42+
protected int $handleTimeout;
5143

5244
public function __construct(ContainerInterface $container, $config)
5345
{

tests/DriverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function getContainer()
5555
$container = Mockery::mock(Container::class);
5656
$container->shouldReceive('has')->andReturn(false);
5757
$container->shouldReceive('get')->with(\Redis::class)->andReturn(new Redis());
58+
$container->shouldReceive('get')->with(Redis::class)->andReturn(new Redis());
5859
$container->shouldReceive('get')->with(PhpSerializerPacker::class)->andReturn(new PhpSerializerPacker());
5960
$container->shouldReceive('get')->with(EventDispatcherInterface::class)->andReturn(null);
6061
$container->shouldReceive('make')->with(ChannelConfig::class, Mockery::any())->andReturnUsing(function ($class, $args) {

tests/Stub/Redis.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
*/
1212
namespace HyperfTest\AsyncQueue\Stub;
1313

14+
use Hyperf\Redis\RedisProxy;
1415
use Hyperf\Utils\Context;
1516

16-
class Redis
17+
class Redis extends RedisProxy
1718
{
19+
public function __construct()
20+
{
21+
}
22+
1823
public function lPush($key, ...$values)
1924
{
2025
Context::set('test.async-queue.lpush.key', $key);

0 commit comments

Comments
 (0)