fix code to phpstan-level-2

This commit is contained in:
crazywhalecc
2022-04-02 23:37:22 +08:00
committed by Jerry Ma
parent be9874a9ad
commit eecbe49955
31 changed files with 450 additions and 384 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace ZM\Utils\Manager;
use Iterator;
use ZM\Config\ZMConfig;
use ZM\Console\Console;
use ZM\Exception\ModulePackException;
@@ -168,8 +169,8 @@ class ModuleManager
/**
* 解包模块
* @param $module
* @return array|false
* @param array|Iterator $module 模块信息
* @return array|false 返回截包的信息或false
*/
public static function unpackModule($module, array $options = [])
{

View File

@@ -11,11 +11,12 @@ use ZM\Console\Console;
class TaskManager
{
/**
* @param $task_name
* @param mixed ...$params
* @return false|mixed
* @param string $task_name 任务名称
* @param int $timeout 超时时间
* @param mixed ...$params 传递参数
* @return false|mixed 执行结果如果执行失败返回false否则为其他任意值
*/
public static function runTask($task_name, int $timeout = -1, ...$params)
public static function runTask(string $task_name, int $timeout = -1, ...$params)
{
if (!isset(server()->setting['task_worker_num'])) {
Console::warning(zm_internal_errcode('E00056') . '未开启 TaskWorker 进程,请先修改 global 配置文件启用!');

View File

@@ -19,11 +19,11 @@ class WorkerManager
{
/**
* Worker 进程间通信触发的动作类型函数
* @param $src_worker_id
* @param $data
* @param int $src_worker_id 源 Worker 进程 ID
* @param array $data 数据
* @throws Exception
*/
public static function workerAction($src_worker_id, $data)
public static function workerAction(int $src_worker_id, array $data)
{
$server = server();
switch ($data['action'] ?? '') {
@@ -106,12 +106,12 @@ class WorkerManager
/**
* 给 Worker 进程发送动作指令(包括自身,自身将直接执行)
* @param $worker_id
* @param $action
* @param $data
* @param int $worker_id 进程ID
* @param string $action 动作
* @param mixed $data 参数
* @throws Exception
*/
public static function sendActionToWorker($worker_id, $action, $data)
public static function sendActionToWorker(int $worker_id, string $action, $data)
{
$obj = ['action' => $action, 'data' => $data];
if (server()->worker_id === -1 && server()->getManagerPid() != posix_getpid()) {