add cs fixer and PHPStan and activate it (build 436)

This commit is contained in:
crazywhalecc
2022-03-15 18:05:33 +08:00
parent d01bd69aa5
commit 1706afbcd0
163 changed files with 4572 additions and 3588 deletions

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types=1);
namespace ZM\Event\SwooleEvent;
use Swoole\Process;
use Swoole\WebSocket\Server;
use ZM\Annotation\Swoole\SwooleHandler;
@@ -13,17 +13,19 @@ use ZM\Event\SwooleEvent;
/**
* Class OnBeforeReload
* @package ZM\Event\SwooleEvent
* @SwooleHandler("BeforeReload")
*/
class OnBeforeReload implements SwooleEvent
{
public function onCall(Server $server) {
Console::info(Console::setColor("Reloading server...", "gold"));
public function onCall(Server $server)
{
Console::info(Console::setColor('Reloading server...', 'gold'));
for ($i = 0; $i < ZM_WORKER_NUM; ++$i) {
Process::kill(zm_atomic("_#worker_" . $i)->get(), SIGUSR1);
Process::kill(zm_atomic('_#worker_' . $i)->get(), SIGUSR1);
}
$conf = ZMConfig::get('global', 'runtime')['reload_delay_time'] ?? 800;
if ($conf !== 0) {
usleep($conf * 1000);
}
$conf = ZMConfig::get("global", "runtime")["reload_delay_time"] ?? 800;
if ($conf !== 0) usleep($conf * 1000);
}
}
}