@@ -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. ' );
@@ -187,7 +187,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
187
187
*
188
188
* @throws LogicException When proc_open is not installed
189
189
*/
190
- public static function fromShellCommandline (string $ command , string $ cwd = null , array $ env = null , mixed $ input = null , ?float $ timeout = 60 ): static
190
+ public static function fromShellCommandline (string $ command , ? string $ cwd = null , ? array $ env = null , mixed $ input = null , ?float $ timeout = 60 ): static
191
191
{
192
192
$ process = new static ([], $ cwd , $ env , $ input , $ timeout );
193
193
$ process ->commandline = $ command ;
@@ -242,7 +242,7 @@ public function __clone()
242
242
*
243
243
* @final
244
244
*/
245
- public function run (callable $ callback = null , array $ env = []): int
245
+ public function run (? callable $ callback = null , array $ env = []): int
246
246
{
247
247
$ this ->start ($ callback , $ env );
248
248
@@ -261,7 +261,7 @@ public function run(callable $callback = null, array $env = []): int
261
261
*
262
262
* @final
263
263
*/
264
- public function mustRun (callable $ callback = null , array $ env = []): static
264
+ public function mustRun (? callable $ callback = null , array $ env = []): static
265
265
{
266
266
if (0 !== $ this ->run ($ callback , $ env )) {
267
267
throw new ProcessFailedException ($ this );
@@ -291,7 +291,7 @@ public function mustRun(callable $callback = null, array $env = []): static
291
291
* @throws RuntimeException When process is already running
292
292
* @throws LogicException In case a callback is provided and output has been disabled
293
293
*/
294
- public function start (callable $ callback = null , array $ env = [])
294
+ public function start (? callable $ callback = null , array $ env = [])
295
295
{
296
296
if ($ this ->isRunning ()) {
297
297
throw new RuntimeException ('Process is already running. ' );
@@ -380,7 +380,7 @@ public function start(callable $callback = null, array $env = [])
380
380
*
381
381
* @final
382
382
*/
383
- public function restart (callable $ callback = null , array $ env = []): static
383
+ public function restart (? callable $ callback = null , array $ env = []): static
384
384
{
385
385
if ($ this ->isRunning ()) {
386
386
throw new RuntimeException ('Process is already running. ' );
@@ -407,7 +407,7 @@ public function restart(callable $callback = null, array $env = []): static
407
407
* @throws ProcessSignaledException When process stopped after receiving signal
408
408
* @throws LogicException When process is not yet started
409
409
*/
410
- public function wait (callable $ callback = null ): int
410
+ public function wait (? callable $ callback = null ): int
411
411
{
412
412
$ this ->requireProcessIsStarted (__FUNCTION__ );
413
413
@@ -880,7 +880,7 @@ public function getStatus(): string
880
880
*
881
881
* @return int|null The exit-code of the process or null if it's not running
882
882
*/
883
- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
883
+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
884
884
{
885
885
$ timeoutMicro = microtime (true ) + $ timeout ;
886
886
if ($ this ->isRunning ()) {
@@ -1258,7 +1258,7 @@ private function getDescriptors(): array
1258
1258
*
1259
1259
* @param callable|null $callback The user defined PHP callback
1260
1260
*/
1261
- protected function buildCallback (callable $ callback = null ): \Closure
1261
+ protected function buildCallback (? callable $ callback = null ): \Closure
1262
1262
{
1263
1263
if ($ this ->outputDisabled ) {
1264
1264
return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments