mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 00:55:35 +08:00
change ctx return force to ContextInterface (build 437)
This commit is contained in:
@@ -71,5 +71,6 @@
|
|||||||
| E00069 | 框架不能启动两个 ConsoleApplication 实例 | 不要重复使用 `new ConsoleApplication()`。 |
|
| E00069 | 框架不能启动两个 ConsoleApplication 实例 | 不要重复使用 `new ConsoleApplication()`。 |
|
||||||
| E00070 | 框架找不到 `zm_data` 目录 | 检查配置中指定的 `zm_data` 目录是否存在。 |
|
| E00070 | 框架找不到 `zm_data` 目录 | 检查配置中指定的 `zm_data` 目录是否存在。 |
|
||||||
| E00071 | 框架找不到对应类型的 API 调用类 | 检查 `getExtendedAPI($name)` 传入的 `$name` 是否正确 |
|
| E00071 | 框架找不到对应类型的 API 调用类 | 检查 `getExtendedAPI($name)` 传入的 `$name` 是否正确 |
|
||||||
|
| E00072 | 上下文无法找到 | 检查上下文环境,如是否处于协程环境中
|
||||||
| E99999 | 未知错误 | |
|
| E99999 | 未知错误 | |
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ use ZM\Exception\InitException;
|
|||||||
|
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION_ID = 436;
|
public const VERSION_ID = 437;
|
||||||
|
|
||||||
public const VERSION = '2.7.0-beta2';
|
public const VERSION = '2.7.0-beta3';
|
||||||
|
|
||||||
private static $obj;
|
private static $obj;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use ZM\Context\ContextInterface;
|
|||||||
use ZM\Event\EventManager;
|
use ZM\Event\EventManager;
|
||||||
use ZM\Exception\RobotNotFoundException;
|
use ZM\Exception\RobotNotFoundException;
|
||||||
use ZM\Exception\ZMException;
|
use ZM\Exception\ZMException;
|
||||||
|
use ZM\Exception\ZMKnownException;
|
||||||
use ZM\Framework;
|
use ZM\Framework;
|
||||||
use ZM\Store\LightCacheInside;
|
use ZM\Store\LightCacheInside;
|
||||||
use ZM\Store\ZMAtomic;
|
use ZM\Store\ZMAtomic;
|
||||||
@@ -224,12 +225,18 @@ function set_coroutine_params($array)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function context(): ?ContextInterface
|
/**
|
||||||
|
* @throws ZMKnownException
|
||||||
|
*/
|
||||||
|
function context(): ContextInterface
|
||||||
{
|
{
|
||||||
return ctx();
|
return ctx();
|
||||||
}
|
}
|
||||||
|
|
||||||
function ctx(): ?ContextInterface
|
/**
|
||||||
|
* @throws ZMKnownException
|
||||||
|
*/
|
||||||
|
function ctx(): ContextInterface
|
||||||
{
|
{
|
||||||
$cid = Co::getCid();
|
$cid = Co::getCid();
|
||||||
$c_class = ZMConfig::get('global', 'context_class');
|
$c_class = ZMConfig::get('global', 'context_class');
|
||||||
@@ -243,8 +250,7 @@ function ctx(): ?ContextInterface
|
|||||||
return ZMBuf::$context_class[$cid] ?? (ZMBuf::$context_class[$cid] = new $c_class($cid));
|
return ZMBuf::$context_class[$cid] ?? (ZMBuf::$context_class[$cid] = new $c_class($cid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
throw new ZMKnownException(zm_internal_errcode('E00072') . 'Unable to find context environment');
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onebot_target_id_name($message_type): string
|
function onebot_target_id_name($message_type): string
|
||||||
|
|||||||
Reference in New Issue
Block a user