Upgrade the minimum php version to 8.0 for etcd.

This commit is contained in:
李铭昕 2021-11-18 09:30:53 +08:00
parent fb20985692
commit 5e668afc61
5 changed files with 6 additions and 27 deletions

View File

@ -1 +0,0 @@
# Etcd

View File

@ -9,7 +9,7 @@
],
"description": "Etcd Client for Hyperf.",
"require": {
"php": ">=7.2",
"php": ">=8.0",
"hyperf/guzzle": "~3.0.0",
"hyperf/utils": "~3.0.0"
},

View File

@ -17,36 +17,16 @@ use Hyperf\Utils\Coroutine;
abstract class Client
{
/**
* @var string
*/
protected $baseUri;
/**
* @var string
*/
protected $version;
/**
* @var array
*/
protected $options = [];
protected string $baseUri;
/**
* @var HandlerStack[]
*/
protected $stacks = [];
protected array $stacks = [];
/**
* @var HandlerStackFactory
*/
protected $factory;
public function __construct(string $uri, string $version, array $options, HandlerStackFactory $factory)
public function __construct(string $uri, string $version, protected array $options, protected HandlerStackFactory $factory)
{
$this->options = $options;
$this->baseUri = sprintf('%s/%s/', $uri, $version);
$this->factory = $factory;
}
protected function getDefaultHandler()

View File

@ -45,6 +45,6 @@ class KVFactory
return make(V3\KV::class, $params);
}
throw new ClientNotFindException(sprintf("KV of {$version} is not find."));
throw new ClientNotFindException("KV of {$version} is not find.");
}
}

View File

@ -748,7 +748,7 @@ class EtcdClient
}
$map = [];
foreach ($data as $index => $value) {
foreach ($data as $value) {
$key = $value['key'];
$map[$key] = $value['value'];
}