@@ -98,7 +98,7 @@ public static function getSignalHandler(int $signal)
|
98 | 98 | *
|
99 | 99 | * @return bool
|
100 | 100 | */
|
101 |
| -public static function asyncSignal(bool $on = null): bool |
| 101 | +public static function asyncSignal(?bool $on = null): bool |
102 | 102 | {
|
103 | 103 | return pcntl_async_signals($on);
|
104 | 104 | }
|
@@ -135,7 +135,7 @@ public static function clearAlarm(): int
|
135 | 135 | *
|
136 | 136 | * @return array{id: int, pid: int, startAt: int}
|
137 | 137 | */
|
138 |
| -public static function fork(callable $onStart, callable $onForkError = null, int $id = 0): array |
| 138 | +public static function fork(callable $onStart, ?callable $onForkError = null, int $id = 0): array |
139 | 139 | {
|
140 | 140 | $info = [];
|
141 | 141 | $pid = pcntl_fork();
|
@@ -170,7 +170,7 @@ public static function fork(callable $onStart, callable $onForkError = null, int
|
170 | 170 | * @return array|false
|
171 | 171 | * @see ProcessUtil::fork()
|
172 | 172 | */
|
173 |
| -public static function create(callable $onStart, callable $onError = null, int $id = 0): bool|array |
| 173 | +public static function create(callable $onStart, ?callable $onError = null, int $id = 0): bool|array |
174 | 174 | {
|
175 | 175 | return self::fork($onStart, $onError, $id);
|
176 | 176 | }
|
@@ -183,7 +183,7 @@ public static function create(callable $onStart, callable $onError = null, int $
|
183 | 183 | * @return int Return new process PID
|
184 | 184 | * @throws RuntimeException
|
185 | 185 | */
|
186 |
| -public static function daemonRun(Closure $beforeQuit = null): int |
| 186 | +public static function daemonRun(?Closure $beforeQuit = null): int |
187 | 187 | {
|
188 | 188 | if (!self::hasPcntl()) {
|
189 | 189 | return 0;
|
@@ -223,7 +223,7 @@ public static function daemonRun(Closure $beforeQuit = null): int
|
223 | 223 | * @return array
|
224 | 224 | * @see ProcessUtil::forks()
|
225 | 225 | */
|
226 |
| -public static function multi(int $number, callable $onStart, callable $onForkError = null): array |
| 226 | +public static function multi(int $number, callable $onStart, ?callable $onForkError = null): array |
227 | 227 | {
|
228 | 228 | return self::forks($number, $onStart, $onForkError);
|
229 | 229 | }
|
@@ -238,7 +238,7 @@ public static function multi(int $number, callable $onStart, callable $onForkErr
|
238 | 238 | * @return array<int, array{id: int, pid: int, startTime: int}>
|
239 | 239 | * @throws RuntimeException
|
240 | 240 | */
|
241 |
| -public static function forks(int $number, callable $onStart, callable $onForkError = null): array |
| 241 | +public static function forks(int $number, callable $onStart, ?callable $onForkError = null): array |
242 | 242 | {
|
243 | 243 | Assert::intShouldGt0($number, 'process number', true);
|
244 | 244 |
|
|
0 commit comments