PHP80 小修 (#187)

* migrate-php80

fix styles
fix static analyse

* fix some bugs
This commit is contained in:
sunxyw
2022-12-19 20:22:47 +08:00
committed by GitHub
parent da516b487d
commit 8ff7da4d23
46 changed files with 180 additions and 366 deletions

View File

@@ -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}] ";
}