@@ -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 ;
@@ -241,7 +241,7 @@ public function __clone()
241
241
*
242
242
* @final
243
243
*/
244
- public function run (callable $ callback = null , array $ env = []): int
244
+ public function run (? callable $ callback = null , array $ env = []): int
245
245
{
246
246
$ this ->start ($ callback , $ env );
247
247
@@ -260,7 +260,7 @@ public function run(callable $callback = null, array $env = []): int
260
260
*
261
261
* @final
262
262
*/
263
- public function mustRun (callable $ callback = null , array $ env = []): static
263
+ public function mustRun (? callable $ callback = null , array $ env = []): static
264
264
{
265
265
if (0 !== $ this ->run ($ callback , $ env )) {
266
266
throw new ProcessFailedException ($ this );
@@ -288,7 +288,7 @@ public function mustRun(callable $callback = null, array $env = []): static
288
288
* @throws RuntimeException When process is already running
289
289
* @throws LogicException In case a callback is provided and output has been disabled
290
290
*/
291
- public function start (callable $ callback = null , array $ env = []): void
291
+ public function start (? callable $ callback = null , array $ env = []): void
292
292
{
293
293
if ($ this ->isRunning ()) {
294
294
throw new RuntimeException ('Process is already running. ' );
@@ -373,7 +373,7 @@ public function start(callable $callback = null, array $env = []): void
373
373
*
374
374
* @final
375
375
*/
376
- public function restart (callable $ callback = null , array $ env = []): static
376
+ public function restart (? callable $ callback = null , array $ env = []): static
377
377
{
378
378
if ($ this ->isRunning ()) {
379
379
throw new RuntimeException ('Process is already running. ' );
@@ -400,7 +400,7 @@ public function restart(callable $callback = null, array $env = []): static
400
400
* @throws ProcessSignaledException When process stopped after receiving signal
401
401
* @throws LogicException When process is not yet started
402
402
*/
403
- public function wait (callable $ callback = null ): int
403
+ public function wait (? callable $ callback = null ): int
404
404
{
405
405
$ this ->requireProcessIsStarted (__FUNCTION__ );
406
406
@@ -873,7 +873,7 @@ public function getStatus(): string
873
873
*
874
874
* @return int|null The exit-code of the process or null if it's not running
875
875
*/
876
- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
876
+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
877
877
{
878
878
$ timeoutMicro = microtime (true ) + $ timeout ;
879
879
if ($ this ->isRunning ()) {
@@ -1247,7 +1247,7 @@ private function getDescriptors(bool $hasCallback): array
1247
1247
*
1248
1248
* @param callable|null $callback The user defined PHP callback
1249
1249
*/
1250
- protected function buildCallback (callable $ callback = null ): \Closure
1250
+ protected function buildCallback (? callable $ callback = null ): \Closure
1251
1251
{
1252
1252
if ($ this ->outputDisabled ) {
1253
1253
return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments