@@ -140,7 +140,7 @@ class Process implements \IteratorAggregate
140
140
*
141
141
* @throws LogicException When proc_open is not installed
142
142
*/
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 )
144
144
{
145
145
if (!\function_exists ('proc_open ' )) {
146
146
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
186
186
*
187
187
* @throws LogicException When proc_open is not installed
188
188
*/
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
190
190
{
191
191
$ process = new static ([], $ cwd , $ env , $ input , $ timeout );
192
192
$ process ->commandline = $ command ;
@@ -244,7 +244,7 @@ public function __clone()
244
244
*
245
245
* @final
246
246
*/
247
- public function run (callable $ callback = null , array $ env = []): int
247
+ public function run (? callable $ callback = null , array $ env = []): int
248
248
{
249
249
$ this ->start ($ callback , $ env );
250
250
@@ -263,7 +263,7 @@ public function run(callable $callback = null, array $env = []): int
263
263
*
264
264
* @final
265
265
*/
266
- public function mustRun (callable $ callback = null , array $ env = []): static
266
+ public function mustRun (? callable $ callback = null , array $ env = []): static
267
267
{
268
268
if (0 !== $ this ->run ($ callback , $ env )) {
269
269
throw new ProcessFailedException ($ this );
@@ -293,7 +293,7 @@ public function mustRun(callable $callback = null, array $env = []): static
293
293
* @throws RuntimeException When process is already running
294
294
* @throws LogicException In case a callback is provided and output has been disabled
295
295
*/
296
- public function start (callable $ callback = null , array $ env = [])
296
+ public function start (? callable $ callback = null , array $ env = [])
297
297
{
298
298
if ($ this ->isRunning ()) {
299
299
throw new RuntimeException ('Process is already running. ' );
@@ -378,7 +378,7 @@ public function start(callable $callback = null, array $env = [])
378
378
*
379
379
* @final
380
380
*/
381
- public function restart (callable $ callback = null , array $ env = []): static
381
+ public function restart (? callable $ callback = null , array $ env = []): static
382
382
{
383
383
if ($ this ->isRunning ()) {
384
384
throw new RuntimeException ('Process is already running. ' );
@@ -405,7 +405,7 @@ public function restart(callable $callback = null, array $env = []): static
405
405
* @throws ProcessSignaledException When process stopped after receiving signal
406
406
* @throws LogicException When process is not yet started
407
407
*/
408
- public function wait (callable $ callback = null ): int
408
+ public function wait (? callable $ callback = null ): int
409
409
{
410
410
$ this ->requireProcessIsStarted (__FUNCTION__ );
411
411
@@ -878,7 +878,7 @@ public function getStatus(): string
878
878
*
879
879
* @return int|null The exit-code of the process or null if it's not running
880
880
*/
881
- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
881
+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
882
882
{
883
883
$ timeoutMicro = microtime (true ) + $ timeout ;
884
884
if ($ this ->isRunning ()) {
@@ -1256,7 +1256,7 @@ private function getDescriptors(bool $hasCallback): array
1256
1256
*
1257
1257
* @param callable|null $callback The user defined PHP callback
1258
1258
*/
1259
- protected function buildCallback (callable $ callback = null ): \Closure
1259
+ protected function buildCallback (? callable $ callback = null ): \Closure
1260
1260
{
1261
1261
if ($ this ->outputDisabled ) {
1262
1262
return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments