This commit is contained in:
2023-12-12 18:03:08 +08:00
parent 1d3c255be8
commit 00c089363f
3 changed files with 229 additions and 205 deletions
+9
View File
@@ -14,6 +14,15 @@ class AsyncContext implements ContextInterface
*/ */
private static array $context = []; private static array $context = [];
/**
* @return bool
*/
public static function inCoroutine(): bool
{
return false;
}
/** /**
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
+6
View File
@@ -7,6 +7,12 @@ interface ContextInterface
{ {
/**
* @return bool
*/
public static function inCoroutine(): bool;
/** /**
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
+9
View File
@@ -9,6 +9,15 @@ class CoroutineContext implements ContextInterface
{ {
/**
* @return bool
*/
public static function inCoroutine(): bool
{
return true;
}
/** /**
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value