mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-22 16:15:34 +08:00
PHP80 小修 (#187)
* migrate-php80 fix styles fix static analyse * fix some bugs
This commit is contained in:
@@ -84,5 +84,5 @@ define('ZM_STATE_DIR', TMP_DIR . '/.zm_' . sha1(ZM_INIT_TIME . FRAMEWORK_ROOT_DI
|
||||
&& define('SWOOLE_HOOK_NATIVE_CURL', 4096)
|
||||
&& define('SWOOLE_HOOK_BLOCKING_FUNCTION', 8192)
|
||||
&& define('SWOOLE_HOOK_SOCKETS', 16384)
|
||||
&& define('SWOOLE_HOOK_ALL', 2147481599)
|
||||
&& define('SWOOLE_HOOK_ALL', 2_147_481_599)
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ if (function_exists('zm_internal_errcode')) {
|
||||
*/
|
||||
function zm_dir(string $dir): string
|
||||
{
|
||||
if (strpos($dir, 'phar://') === 0) {
|
||||
if (str_starts_with($dir, 'phar://')) {
|
||||
return $dir;
|
||||
}
|
||||
return str_replace('/', DIRECTORY_SEPARATOR, $dir);
|
||||
@@ -46,10 +46,8 @@ function zm_exec(string $cmd): ExecutionResult
|
||||
|
||||
/**
|
||||
* sleep 指定时间,单位为秒(最小单位为1毫秒,即0.001)
|
||||
*
|
||||
* @param float|int $time
|
||||
*/
|
||||
function zm_sleep($time)
|
||||
function zm_sleep(float|int $time)
|
||||
{
|
||||
Adaptive::sleep($time);
|
||||
}
|
||||
@@ -64,10 +62,8 @@ function coroutine(): ?CoroutineInterface
|
||||
|
||||
/**
|
||||
* 获取内部错误码
|
||||
*
|
||||
* @param int|string $code
|
||||
*/
|
||||
function zm_internal_errcode($code): string
|
||||
function zm_internal_errcode(int|string $code): string
|
||||
{
|
||||
return "[ErrCode:{$code}] ";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user