@@ -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
0 commit comments