Skip to content

Commit cf9dcfe

Browse files
authored
Merge pull request #6 from ichynul/main
php8兼容和问题修复
2 parents 807d869 + 1ee2b5b commit cf9dcfe

File tree

3 files changed

+11
-572
lines changed

3 files changed

+11
-572
lines changed

src/CacheManager.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public function getDefaultDriver(): ?string
4747
* @param mixed|null $default 默认值
4848
* @return mixed
4949
*/
50-
public function getConfig(string $name = null, mixed $default = null): mixed
50+
public function getConfig(string $name = '', mixed $default = null): mixed
5151
{
52-
if (!is_null($name)) {
52+
if ($name) {
5353
return config("think-cache.$name", $default);
5454
}
5555

@@ -63,10 +63,10 @@ public function getConfig(string $name = null, mixed $default = null): mixed
6363
* @param mixed|null $default
6464
* @return mixed
6565
*/
66-
public function getStoreConfig(string $store, string $name = null, mixed $default = null): mixed
66+
public function getStoreConfig(string $store, string $name = '', mixed $default = null): mixed
6767
{
6868
if ($config = $this->getConfig("stores.{$store}")) {
69-
return Arr::get($config, $name, $default);
69+
return $name ? Arr::get($config, $name, $default) : $config;
7070
}
7171

7272
throw new \InvalidArgumentException("Store [$store] not found.");
@@ -97,7 +97,7 @@ protected function resolveConfig(string $name): mixed
9797
* @return Driver
9898
* @throws ReflectionException
9999
*/
100-
public function store(string $name = null): Driver
100+
public function store(string $name = ''): Driver
101101
{
102102
return $this->driver($name);
103103
}

0 commit comments

Comments
 (0)