@@ -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 , $ input = null , ?float $ timeout = 60 )
143+ public function __construct (array $ command , ? string $ cwd = null , ? array $ env = null , $ 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. ' );
@@ -189,7 +189,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
189189 *
190190 * @throws LogicException When proc_open is not installed
191191 */
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 )
193193 {
194194 $ process = new static ([], $ cwd , $ env , $ input , $ timeout );
195195 $ process ->commandline = $ command ;
@@ -247,7 +247,7 @@ public function __clone()
247247 *
248248 * @final
249249 */
250- public function run (callable $ callback = null , array $ env = []): int
250+ public function run (? callable $ callback = null , array $ env = []): int
251251 {
252252 $ this ->start ($ callback , $ env );
253253
@@ -266,7 +266,7 @@ public function run(callable $callback = null, array $env = []): int
266266 *
267267 * @final
268268 */
269- public function mustRun (callable $ callback = null , array $ env = []): self
269+ public function mustRun (? callable $ callback = null , array $ env = []): self
270270 {
271271 if (0 !== $ this ->run ($ callback , $ env )) {
272272 throw new ProcessFailedException ($ this );
@@ -294,7 +294,7 @@ public function mustRun(callable $callback = null, array $env = []): self
294294 * @throws RuntimeException When process is already running
295295 * @throws LogicException In case a callback is provided and output has been disabled
296296 */
297- public function start (callable $ callback = null , array $ env = [])
297+ public function start (? callable $ callback = null , array $ env = [])
298298 {
299299 if ($ this ->isRunning ()) {
300300 throw new RuntimeException ('Process is already running. ' );
@@ -385,7 +385,7 @@ public function start(callable $callback = null, array $env = [])
385385 *
386386 * @final
387387 */
388- public function restart (callable $ callback = null , array $ env = []): self
388+ public function restart (? callable $ callback = null , array $ env = []): self
389389 {
390390 if ($ this ->isRunning ()) {
391391 throw new RuntimeException ('Process is already running. ' );
@@ -412,7 +412,7 @@ public function restart(callable $callback = null, array $env = []): self
412412 * @throws ProcessSignaledException When process stopped after receiving signal
413413 * @throws LogicException When process is not yet started
414414 */
415- public function wait (callable $ callback = null )
415+ public function wait (? callable $ callback = null )
416416 {
417417 $ this ->requireProcessIsStarted (__FUNCTION__ );
418418
@@ -914,7 +914,7 @@ public function getStatus()
914914 *
915915 * @return int|null The exit-code of the process or null if it's not running
916916 */
917- public function stop (float $ timeout = 10 , int $ signal = null )
917+ public function stop (float $ timeout = 10 , ? int $ signal = null )
918918 {
919919 $ timeoutMicro = microtime (true ) + $ timeout ;
920920 if ($ this ->isRunning ()) {
@@ -1310,7 +1310,7 @@ private function getDescriptors(): array
13101310 *
13111311 * @return \Closure
13121312 */
1313- protected function buildCallback (callable $ callback = null )
1313+ protected function buildCallback (? callable $ callback = null )
13141314 {
13151315 if ($ this ->outputDisabled ) {
13161316 return function ($ type , $ data ) use ($ callback ): bool {
0 commit comments