@@ -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. ' );
@@ -186,7 +186,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
186186 *
187187 * @throws LogicException When proc_open is not installed
188188 */
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
190190 {
191191 $ process = new static ([], $ cwd , $ env , $ input , $ timeout );
192192 $ process ->commandline = $ command ;
@@ -244,7 +244,7 @@ public function __clone()
244244 *
245245 * @final
246246 */
247- public function run (callable $ callback = null , array $ env = []): int
247+ public function run (? callable $ callback = null , array $ env = []): int
248248 {
249249 $ this ->start ($ callback , $ env );
250250
@@ -263,7 +263,7 @@ public function run(callable $callback = null, array $env = []): int
263263 *
264264 * @final
265265 */
266- public function mustRun (callable $ callback = null , array $ env = []): static
266+ public function mustRun (? callable $ callback = null , array $ env = []): static
267267 {
268268 if (0 !== $ this ->run ($ callback , $ env )) {
269269 throw new ProcessFailedException ($ this );
@@ -293,7 +293,7 @@ public function mustRun(callable $callback = null, array $env = []): static
293293 * @throws RuntimeException When process is already running
294294 * @throws LogicException In case a callback is provided and output has been disabled
295295 */
296- public function start (callable $ callback = null , array $ env = [])
296+ public function start (? callable $ callback = null , array $ env = [])
297297 {
298298 if ($ this ->isRunning ()) {
299299 throw new RuntimeException ('Process is already running. ' );
@@ -378,7 +378,7 @@ public function start(callable $callback = null, array $env = [])
378378 *
379379 * @final
380380 */
381- public function restart (callable $ callback = null , array $ env = []): static
381+ public function restart (? callable $ callback = null , array $ env = []): static
382382 {
383383 if ($ this ->isRunning ()) {
384384 throw new RuntimeException ('Process is already running. ' );
@@ -405,7 +405,7 @@ public function restart(callable $callback = null, array $env = []): static
405405 * @throws ProcessSignaledException When process stopped after receiving signal
406406 * @throws LogicException When process is not yet started
407407 */
408- public function wait (callable $ callback = null ): int
408+ public function wait (? callable $ callback = null ): int
409409 {
410410 $ this ->requireProcessIsStarted (__FUNCTION__ );
411411
@@ -878,7 +878,7 @@ public function getStatus(): string
878878 *
879879 * @return int|null The exit-code of the process or null if it's not running
880880 */
881- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
881+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
882882 {
883883 $ timeoutMicro = microtime (true ) + $ timeout ;
884884 if ($ this ->isRunning ()) {
@@ -1256,7 +1256,7 @@ private function getDescriptors(bool $hasCallback): array
12561256 *
12571257 * @param callable|null $callback The user defined PHP callback
12581258 */
1259- protected function buildCallback (callable $ callback = null ): \Closure
1259+ protected function buildCallback (? callable $ callback = null ): \Closure
12601260 {
12611261 if ($ this ->outputDisabled ) {
12621262 return fn ($ type , $ data ): bool => null !== $ callback && $ callback ($ type , $ data );
0 commit comments