fix the rest problem code to phpstan-level-1

This commit is contained in:
crazywhalecc 2022-04-02 19:20:47 +08:00 committed by Jerry Ma
parent d490892092
commit daa1822bc5
4 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,6 @@
parameters:
reportUnmatchedIgnoredErrors: false
level: 0
level: 1
paths:
- ./src/
ignoreErrors:

View File

@ -44,7 +44,7 @@ class UpdateBody
$msg[] = $k . ' = ?';
$arr[] = $v;
}
if (($msg ?? []) == []) {
if ($msg == []) {
throw new DbException('update value sets can not be empty!');
}
$line = 'UPDATE ' . $this->table->getTableName() . ' SET ' . implode(', ', $msg);

View File

@ -14,10 +14,9 @@ use ZM\Utils\Manager\WorkerManager;
class CoMessage
{
/**
* @param int $timeout
* @return mixed
*/
public static function yieldByWS(array $hang, array $compare, $timeout = 600)
public static function yieldByWS(array $hang, array $compare, int $timeout = 600)
{
$cid = Coroutine::getuid();
$api_id = ZMAtomic::get('wait_msg_id')->add(1);
@ -43,9 +42,7 @@ class CoMessage
unset($sess[$api_id]);
LightCacheInside::set('wait_api', 'wait_api', $sess);
SpinLock::unlock('wait_api');
if (isset($id)) {
swoole_timer_clear($id);
}
swoole_timer_clear($id);
if ($result === null) {
return false;
}

View File

@ -22,12 +22,13 @@ class MessageUtil
/**
* 下载消息中 CQ 码的所有图片,通过 url
* @param $msg
* @param null $path
* @return array|false
*/
public static function downloadCQImage($msg, $path = null)
public static function downloadCQImage($msg, ?string $path = null)
{
$path = $path ?? DataProvider::getDataFolder() . 'images/';
if ($path === null) {
$path = DataProvider::getDataFolder() . 'images/';
}
if (!is_dir($path)) {
@mkdir($path);
}