@@ -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 , $ input = null , ?float $ timeout = 60 )
143
+ public function __construct (array $ command , ? string $ cwd = null , ? array $ env = null , $ 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. ' );
@@ -189,7 +189,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
189
189
*
190
190
* @throws LogicException When proc_open is not installed
191
191
*/
192
- public static function fromShellCommandline (string $ command , string $ cwd = null , array $ env = null , $ input = null , ?float $ timeout = 60 )
192
+ public static function fromShellCommandline (string $ command , ? string $ cwd = null , ? array $ env = null , $ input = null , ?float $ timeout = 60 )
193
193
{
194
194
$ process = new static ([], $ cwd , $ env , $ input , $ timeout );
195
195
$ process ->commandline = $ command ;
@@ -247,7 +247,7 @@ public function __clone()
247
247
*
248
248
* @final
249
249
*/
250
- public function run (callable $ callback = null , array $ env = []): int
250
+ public function run (? callable $ callback = null , array $ env = []): int
251
251
{
252
252
$ this ->start ($ callback , $ env );
253
253
@@ -266,7 +266,7 @@ public function run(callable $callback = null, array $env = []): int
266
266
*
267
267
* @final
268
268
*/
269
- public function mustRun (callable $ callback = null , array $ env = []): self
269
+ public function mustRun (? callable $ callback = null , array $ env = []): self
270
270
{
271
271
if (0 !== $ this ->run ($ callback , $ env )) {
272
272
throw new ProcessFailedException ($ this );
@@ -294,7 +294,7 @@ public function mustRun(callable $callback = null, array $env = []): self
294
294
* @throws RuntimeException When process is already running
295
295
* @throws LogicException In case a callback is provided and output has been disabled
296
296
*/
297
- public function start (callable $ callback = null , array $ env = [])
297
+ public function start (? callable $ callback = null , array $ env = [])
298
298
{
299
299
if ($ this ->isRunning ()) {
300
300
throw new RuntimeException ('Process is already running. ' );
@@ -385,7 +385,7 @@ public function start(callable $callback = null, array $env = [])
385
385
*
386
386
* @final
387
387
*/
388
- public function restart (callable $ callback = null , array $ env = []): self
388
+ public function restart (? callable $ callback = null , array $ env = []): self
389
389
{
390
390
if ($ this ->isRunning ()) {
391
391
throw new RuntimeException ('Process is already running. ' );
@@ -412,7 +412,7 @@ public function restart(callable $callback = null, array $env = []): self
412
412
* @throws ProcessSignaledException When process stopped after receiving signal
413
413
* @throws LogicException When process is not yet started
414
414
*/
415
- public function wait (callable $ callback = null )
415
+ public function wait (? callable $ callback = null )
416
416
{
417
417
$ this ->requireProcessIsStarted (__FUNCTION__ );
418
418
@@ -914,7 +914,7 @@ public function getStatus()
914
914
*
915
915
* @return int|null The exit-code of the process or null if it's not running
916
916
*/
917
- public function stop (float $ timeout = 10 , int $ signal = null )
917
+ public function stop (float $ timeout = 10 , ? int $ signal = null )
918
918
{
919
919
$ timeoutMicro = microtime (true ) + $ timeout ;
920
920
if ($ this ->isRunning ()) {
@@ -1310,7 +1310,7 @@ private function getDescriptors(): array
1310
1310
*
1311
1311
* @return \Closure
1312
1312
*/
1313
- protected function buildCallback (callable $ callback = null )
1313
+ protected function buildCallback (? callable $ callback = null )
1314
1314
{
1315
1315
if ($ this ->outputDisabled ) {
1316
1316
return function ($ type , $ data ) use ($ callback ): bool {
0 commit comments