@@ -140,7 +140,7 @@ class Process implements \IteratorAggregate
140140 *
141141 * @throws LogicException When proc_open is not installed
142142 */
143- public function __construct (array $ command , string $ cwd = null , array $ env = null , mixed $ input = null , ?float $ timeout = 60 )
143+ public function __construct (array $ command , ? string $ cwd = null , ? array $ env = null , mixed $ input = null , ?float $ timeout = 60 )
144144 {
145145 if (!\function_exists ('proc_open ' )) {
146146 throw new LogicException ('The Process class relies on proc_open, which is not available on your PHP installation. ' );
@@ -186,7 +186,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
186186 *
187187 * @throws LogicException When proc_open is not installed
188188 */
189- public static function fromShellCommandline (string $ command , string $ cwd = null , array $ env = null , mixed $ input = null , ?float $ timeout = 60 ): static
189+ public static function fromShellCommandline (string $ command , ? string $ cwd = null , ? array $ env = null , mixed $ input = null , ?float $ timeout = 60 ): static
190190 {
191191 $ process = new static ([], $ cwd , $ env , $ input , $ timeout );
192192 $ process ->commandline = $ command ;
@@ -241,7 +241,7 @@ public function __clone()
241241 *
242242 * @final
243243 */
244- public function run (callable $ callback = null , array $ env = []): int
244+ public function run (? callable $ callback = null , array $ env = []): int
245245 {
246246 $ this ->start ($ callback , $ env );
247247
@@ -260,7 +260,7 @@ public function run(callable $callback = null, array $env = []): int
260260 *
261261 * @final
262262 */
263- public function mustRun (callable $ callback = null , array $ env = []): static
263+ public function mustRun (? callable $ callback = null , array $ env = []): static
264264 {
265265 if (0 !== $ this ->run ($ callback , $ env )) {
266266 throw new ProcessFailedException ($ this );
@@ -288,7 +288,7 @@ public function mustRun(callable $callback = null, array $env = []): static
288288 * @throws RuntimeException When process is already running
289289 * @throws LogicException In case a callback is provided and output has been disabled
290290 */
291- public function start (callable $ callback = null , array $ env = []): void
291+ public function start (? callable $ callback = null , array $ env = []): void
292292 {
293293 if ($ this ->isRunning ()) {
294294 throw new RuntimeException ('Process is already running. ' );
@@ -373,7 +373,7 @@ public function start(callable $callback = null, array $env = []): void
373373 *
374374 * @final
375375 */
376- public function restart (callable $ callback = null , array $ env = []): static
376+ public function restart (? callable $ callback = null , array $ env = []): static
377377 {
378378 if ($ this ->isRunning ()) {
379379 throw new RuntimeException ('Process is already running. ' );
@@ -400,7 +400,7 @@ public function restart(callable $callback = null, array $env = []): static
400400 * @throws ProcessSignaledException When process stopped after receiving signal
401401 * @throws LogicException When process is not yet started
402402 */
403- public function wait (callable $ callback = null ): int
403+ public function wait (? callable $ callback = null ): int
404404 {
405405 $ this ->requireProcessIsStarted (__FUNCTION__ );
406406
@@ -873,7 +873,7 @@ public function getStatus(): string
873873 *
874874 * @return int|null The exit-code of the process or null if it's not running
875875 */
876- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
876+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
877877 {
878878 $ timeoutMicro = microtime (true ) + $ timeout ;
879879 if ($ this ->isRunning ()) {
@@ -1247,7 +1247,7 @@ private function getDescriptors(bool $hasCallback): array
12471247 *
12481248 * @param callable|null $callback The user defined PHP callback
12491249 */
1250- protected function buildCallback (callable $ callback = null ): \Closure
1250+ protected function buildCallback (? callable $ callback = null ): \Closure
12511251 {
12521252 if ($ this ->outputDisabled ) {
12531253 return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments