Skip to content

Commit 4bf70e4

Browse files
committed
format all codes
1 parent 3d879e1 commit 4bf70e4

File tree

3 files changed

+58
-59
lines changed

3 files changed

+58
-59
lines changed

src/ProcessUtil.php

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ProcessUtil
1818
* @var array
1919
*/
2020
public static $signalMap = [
21-
SIGINT => 'SIGINT(Ctrl+C)',
21+
SIGINT => 'SIGINT(Ctrl+C)',
2222
SIGTERM => 'SIGTERM',
2323
SIGKILL => 'SIGKILL',
2424
SIGSTOP => 'SIGSTOP',
@@ -28,7 +28,7 @@ class ProcessUtil
2828
* fork/create a child process.
2929
* @param callable|null $onStart Will running on the child process start.
3030
* @param callable|null $onError
31-
* @param int $id The process index number. will use `forks()`
31+
* @param int $id The process index number. will use `forks()`
3232
* @return array|false
3333
* @throws \RuntimeException
3434
*/
@@ -44,8 +44,8 @@ public static function fork(callable $onStart = null, callable $onError = null,
4444
// at parent, get forked child info
4545
if ($pid > 0) {
4646
$info = [
47-
'id' => $id,
48-
'pid' => $pid,
47+
'id' => $id,
48+
'pid' => $pid,
4949
'startTime' => \time(),
5050
];
5151
} elseif ($pid === 0) { // at child
@@ -69,7 +69,7 @@ public static function fork(callable $onStart = null, callable $onError = null,
6969
* @see ProcessUtil::fork()
7070
* @param callable|null $onStart
7171
* @param callable|null $onError
72-
* @param int $id
72+
* @param int $id
7373
* @return array|false
7474
* @throws \RuntimeException
7575
*/
@@ -122,7 +122,7 @@ public static function daemonRun(\Closure $beforeQuit = null): int
122122

123123
/**
124124
* @see ProcessUtil::forks()
125-
* @param int $number
125+
* @param int $number
126126
* @param callable|null $onStart
127127
* @param callable|null $onError
128128
* @return array|false
@@ -135,7 +135,7 @@ public static function multi(int $number, callable $onStart = null, callable $on
135135

136136
/**
137137
* fork/create multi child processes.
138-
* @param int $number
138+
* @param int $number
139139
* @param callable|null $onStart Will running on the child processes.
140140
* @param callable|null $onError
141141
* @return array|false
@@ -198,7 +198,7 @@ public static function wait(callable $onExit): bool
198198
* ],
199199
* ... ...
200200
* ]
201-
* @param int $signal
201+
* @param int $signal
202202
* @param array $events
203203
* [
204204
* 'beforeStops' => function ($sigText) {
@@ -222,7 +222,7 @@ public static function stopWorkers(array $children, int $signal = \SIGTERM, arra
222222

223223
$events = \array_merge([
224224
'beforeStops' => null,
225-
'beforeStop' => null,
225+
'beforeStop' => null,
226226
], $events);
227227

228228
if ($cb = $events['beforeStops']) {
@@ -247,9 +247,9 @@ public static function stopWorkers(array $children, int $signal = \SIGTERM, arra
247247

248248
/**
249249
* send kill signal to the process
250-
* @param int $pid
250+
* @param int $pid
251251
* @param bool $force
252-
* @param int $timeout
252+
* @param int $timeout
253253
* @return bool
254254
*/
255255
public static function kill(int $pid, bool $force = false, int $timeout = 3): bool
@@ -259,10 +259,10 @@ public static function kill(int $pid, bool $force = false, int $timeout = 3): bo
259259

260260
/**
261261
* Do shutdown process and wait it exit.
262-
* @param int $pid Master Pid
263-
* @param bool $force
264-
* @param int $waitTime
265-
* @param null $error
262+
* @param int $pid Master Pid
263+
* @param bool $force
264+
* @param int $waitTime
265+
* @param null $error
266266
* @param string $name
267267
* @return bool
268268
*/
@@ -272,8 +272,7 @@ public static function killAndWait(
272272
$name = 'process',
273273
bool $force = false,
274274
int $waitTime = 10
275-
): bool
276-
{
275+
): bool {
277276
// do stop
278277
if (!self::kill($pid, $force)) {
279278
$error = "Send stop signal to the $name(PID:$pid) failed!";
@@ -333,7 +332,7 @@ public static function quit($code = 0)
333332

334333
/**
335334
* 杀死所有进程
336-
* @param $name
335+
* @param $name
337336
* @param int $sigNo
338337
* @return string
339338
*/
@@ -397,7 +396,7 @@ public static function sendSignal(int $pid, int $signal, int $timeout = 0): bool
397396

398397
/**
399398
* install signal
400-
* @param int $signal e.g: SIGTERM SIGINT(Ctrl+C) SIGUSR1 SIGUSR2 SIGHUP
399+
* @param int $signal e.g: SIGTERM SIGINT(Ctrl+C) SIGUSR1 SIGUSR2 SIGHUP
401400
* @param callable $handler
402401
* @return bool
403402
*/
@@ -468,7 +467,7 @@ public static function getPid(): int
468467
/**
469468
* get PID by pid File
470469
* @param string $file
471-
* @param bool $checkLive
470+
* @param bool $checkLive
472471
* @return int
473472
*/
474473
public static function getPidByFile(string $file, bool $checkLive = false): int
@@ -506,7 +505,7 @@ public static function getCurrentUser(): array
506505
* ProcessUtil::clearAlarm(); // close
507506
* }
508507
* });
509-
* @param int $seconds
508+
* @param int $seconds
510509
* @param callable $handler
511510
* @return bool|int
512511
*/
@@ -531,7 +530,7 @@ public static function clearAlarm(): int
531530

532531
/**
533532
* run a command. it is support windows
534-
* @param string $command
533+
* @param string $command
535534
* @param string|null $cwd
536535
* @return array
537536
* @throws \RuntimeException

src/Signal.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,39 @@ class Signal
1919
const DFL = 0;
2020
const ERR = -1;
2121

22-
const HUP = 1;
23-
const INT = 2; // Ctrl+C
24-
const QUIT = 3;
25-
const ILL = 4;
26-
const TRAP = 5;
27-
const ABRT = 6;
28-
const IOT = 6;
29-
const BUS = 7;
30-
const FPE = 8;
31-
const KILL = 9;
32-
const USR1 = 10;
33-
const SEGV = 11;
34-
const USR2 = 12;
35-
const PIPE = 13;
36-
const ALRM = 14;
37-
const TERM = 15;
22+
const HUP = 1;
23+
const INT = 2; // Ctrl+C
24+
const QUIT = 3;
25+
const ILL = 4;
26+
const TRAP = 5;
27+
const ABRT = 6;
28+
const IOT = 6;
29+
const BUS = 7;
30+
const FPE = 8;
31+
const KILL = 9;
32+
const USR1 = 10;
33+
const SEGV = 11;
34+
const USR2 = 12;
35+
const PIPE = 13;
36+
const ALRM = 14;
37+
const TERM = 15;
3838
const STKFLT = 16;
39-
const CLD = 17;
40-
const CHLD = 17;
41-
const CONT = 18;
42-
const STOP = 19;
43-
const TSTP = 20;
44-
const TTIN = 21;
45-
const TTOU = 22;
46-
const URG = 23;
47-
const XCPU = 24;
48-
const XFSZ = 25;
39+
const CLD = 17;
40+
const CHLD = 17;
41+
const CONT = 18;
42+
const STOP = 19;
43+
const TSTP = 20;
44+
const TTIN = 21;
45+
const TTOU = 22;
46+
const URG = 23;
47+
const XCPU = 24;
48+
const XFSZ = 25;
4949
const VTALRM = 26;
50-
const PROF = 27;
51-
const WINCH = 28;
52-
const POLL = 29;
53-
const IO = 29;
54-
const PWR = 30;
55-
const SYS = 31;
56-
const BABY = 31;
50+
const PROF = 27;
51+
const WINCH = 28;
52+
const POLL = 29;
53+
const IO = 29;
54+
const PWR = 30;
55+
const SYS = 31;
56+
const BABY = 31;
5757
}

src/Sys.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Sys extends SysEnv
1616
{
1717
/**
18-
* @param string $command
18+
* @param string $command
1919
* @param null|string $logfile
2020
* @param null|string $user
2121
* @return mixed
@@ -45,7 +45,7 @@ public static function exec($command, $logfile = null, $user = null)
4545

4646
/**
4747
* run a command. it is support windows
48-
* @param string $command
48+
* @param string $command
4949
* @param string|null $cwd
5050
* @return array
5151
* @throws \RuntimeException
@@ -90,8 +90,8 @@ public static function run(string $command, string $cwd = null): array
9090
* 2. passthru
9191
* 3. exec
9292
* 4. shell_exec
93-
* @param string $command
94-
* @param bool $returnStatus
93+
* @param string $command
94+
* @param bool $returnStatus
9595
* @param string|null $cwd
9696
* @return array|string
9797
*/

0 commit comments

Comments
 (0)