@@ -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 , mixed $ input = null , ?float $ timeout = 60 )
143+ public function __construct (array $ command , ? string $ cwd = null , ? array $ env = null , mixed $ 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. ' );
@@ -187,7 +187,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
187187 *
188188 * @throws LogicException When proc_open is not installed
189189 */
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
191191 {
192192 $ process = new static ([], $ cwd , $ env , $ input , $ timeout );
193193 $ process ->commandline = $ command ;
@@ -242,7 +242,7 @@ public function __clone()
242242 *
243243 * @final
244244 */
245- public function run (callable $ callback = null , array $ env = []): int
245+ public function run (? callable $ callback = null , array $ env = []): int
246246 {
247247 $ this ->start ($ callback , $ env );
248248
@@ -261,7 +261,7 @@ public function run(callable $callback = null, array $env = []): int
261261 *
262262 * @final
263263 */
264- public function mustRun (callable $ callback = null , array $ env = []): static
264+ public function mustRun (? callable $ callback = null , array $ env = []): static
265265 {
266266 if (0 !== $ this ->run ($ callback , $ env )) {
267267 throw new ProcessFailedException ($ this );
@@ -291,7 +291,7 @@ public function mustRun(callable $callback = null, array $env = []): static
291291 * @throws RuntimeException When process is already running
292292 * @throws LogicException In case a callback is provided and output has been disabled
293293 */
294- public function start (callable $ callback = null , array $ env = [])
294+ public function start (? callable $ callback = null , array $ env = [])
295295 {
296296 if ($ this ->isRunning ()) {
297297 throw new RuntimeException ('Process is already running. ' );
@@ -380,7 +380,7 @@ public function start(callable $callback = null, array $env = [])
380380 *
381381 * @final
382382 */
383- public function restart (callable $ callback = null , array $ env = []): static
383+ public function restart (? callable $ callback = null , array $ env = []): static
384384 {
385385 if ($ this ->isRunning ()) {
386386 throw new RuntimeException ('Process is already running. ' );
@@ -407,7 +407,7 @@ public function restart(callable $callback = null, array $env = []): static
407407 * @throws ProcessSignaledException When process stopped after receiving signal
408408 * @throws LogicException When process is not yet started
409409 */
410- public function wait (callable $ callback = null ): int
410+ public function wait (? callable $ callback = null ): int
411411 {
412412 $ this ->requireProcessIsStarted (__FUNCTION__ );
413413
@@ -880,7 +880,7 @@ public function getStatus(): string
880880 *
881881 * @return int|null The exit-code of the process or null if it's not running
882882 */
883- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
883+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
884884 {
885885 $ timeoutMicro = microtime (true ) + $ timeout ;
886886 if ($ this ->isRunning ()) {
@@ -1258,7 +1258,7 @@ private function getDescriptors(): array
12581258 *
12591259 * @param callable|null $callback The user defined PHP callback
12601260 */
1261- protected function buildCallback (callable $ callback = null ): \Closure
1261+ protected function buildCallback (? callable $ callback = null ): \Closure
12621262 {
12631263 if ($ this ->outputDisabled ) {
12641264 return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments