This commit is contained in:
2020-09-09 19:08:12 +08:00
parent e58e388d3b
commit 22130526c8
+3 -4
View File
@@ -64,15 +64,14 @@ class Context extends BaseContext
if (!static::hasContext($id)) { if (!static::hasContext($id)) {
Coroutine::getContext()[$id] = []; Coroutine::getContext()[$id] = [];
} }
if (!empty($key)) { if (empty($key)) {
return Coroutine::getContext()[$id] = $context;
}
if (!is_array(Coroutine::getContext()[$id])) { if (!is_array(Coroutine::getContext()[$id])) {
Coroutine::getContext()[$id] = [$key => $context]; Coroutine::getContext()[$id] = [$key => $context];
} else { } else {
Coroutine::getContext()[$id][$key] = $context; Coroutine::getContext()[$id][$key] = $context;
} }
} else {
Coroutine::getContext()[$id] = $context;
}
return $context; return $context;
} }