Skip to content

Commit

Permalink
code quality improvements for PHP 8.1+ using Rector
Browse files Browse the repository at this point in the history
  • Loading branch information
deminy committed May 25, 2024
1 parent d2fa3b9 commit 8aa2425
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 151 deletions.
2 changes: 1 addition & 1 deletion src/core/Coroutine/Barrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function make(): self
/**
* @throws Exception
*/
public static function wait(Barrier &$barrier, float $timeout = -1)
public static function wait(Barrier &$barrier, float $timeout = -1): void
{
if ($barrier->cid !== -1) {
throw new Exception('The barrier is waiting, cannot wait again.');
Expand Down
2 changes: 1 addition & 1 deletion src/core/Server/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Admin

private static string $accessToken = '';

public static function init(Server $server)
public static function init(Server $server): void
{
$accepted_process_types = SWOOLE_SERVER_COMMAND_MASTER |
SWOOLE_SERVER_COMMAND_MANAGER |
Expand Down
8 changes: 4 additions & 4 deletions src/core/Server/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Helper
'admin_server' => true,
];

public static function checkOptions(array $input_options)
public static function checkOptions(array $input_options): void
{
$const_options = self::GLOBAL_OPTIONS + self::SERVER_OPTIONS + self::PORT_OPTIONS
+ self::AIO_OPTIONS + self::COROUTINE_OPTIONS + self::HELPER_OPTIONS;
Expand All @@ -215,7 +215,7 @@ public static function checkOptions(array $input_options)
}
}

public static function onBeforeStart(Server $server)
public static function onBeforeStart(Server $server): void
{
if (!empty($server->setting['admin_server'])) {
Admin::init($server);
Expand All @@ -230,7 +230,7 @@ public static function onBeforeShutdown(Server $server): void
}
}

public static function onWorkerStart(Server $server, int $workerId)
public static function onWorkerStart(Server $server, int $workerId): void
{
if (!empty($server->setting['stats_file']) and $workerId == 0) {
$interval_ms = empty($server->setting['stats_timer_interval']) ? self::STATS_TIMER_INTERVAL_TIME : intval($server->setting['stats_timer_interval']);
Expand All @@ -254,7 +254,7 @@ public static function onWorkerStart(Server $server, int $workerId)
}
}

public static function onWorkerExit(Server $server, int $workerId)
public static function onWorkerExit(Server $server, int $workerId): void
{
if ($server->stats_timer) {
Timer::clear($server->stats_timer);
Expand Down
Loading

0 comments on commit 8aa2425

Please sign in to comment.