@@ -141,7 +141,7 @@ class Process implements \IteratorAggregate
141141 *
142142 * @throws LogicException When proc_open is not installed
143143 */
144- public function __construct (array $ command , string $ cwd = null , array $ env = null , mixed $ input = null , ?float $ timeout = 60 )
144+ public function __construct (array $ command , ? string $ cwd = null , ? array $ env = null , mixed $ input = null , ?float $ timeout = 60 )
145145 {
146146 if (!\function_exists ('proc_open ' )) {
147147 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 );
@@ -289,7 +289,7 @@ public function mustRun(callable $callback = null, array $env = []): static
289289 * @throws RuntimeException When process is already running
290290 * @throws LogicException In case a callback is provided and output has been disabled
291291 */
292- public function start (callable $ callback = null , array $ env = []): void
292+ public function start (? callable $ callback = null , array $ env = []): void
293293 {
294294 if ($ this ->isRunning ()) {
295295 throw new RuntimeException ('Process is already running. ' );
@@ -384,7 +384,7 @@ public function start(callable $callback = null, array $env = []): void
384384 *
385385 * @final
386386 */
387- public function restart (callable $ callback = null , array $ env = []): static
387+ public function restart (? callable $ callback = null , array $ env = []): static
388388 {
389389 if ($ this ->isRunning ()) {
390390 throw new RuntimeException ('Process is already running. ' );
@@ -411,7 +411,7 @@ public function restart(callable $callback = null, array $env = []): static
411411 * @throws ProcessSignaledException When process stopped after receiving signal
412412 * @throws LogicException When process is not yet started
413413 */
414- public function wait (callable $ callback = null ): int
414+ public function wait (? callable $ callback = null ): int
415415 {
416416 $ this ->requireProcessIsStarted (__FUNCTION__ );
417417
@@ -884,7 +884,7 @@ public function getStatus(): string
884884 *
885885 * @return int|null The exit-code of the process or null if it's not running
886886 */
887- public function stop (float $ timeout = 10 , int $ signal = null ): ?int
887+ public function stop (float $ timeout = 10 , ? int $ signal = null ): ?int
888888 {
889889 $ timeoutMicro = microtime (true ) + $ timeout ;
890890 if ($ this ->isRunning ()) {
@@ -1258,7 +1258,7 @@ private function getDescriptors(bool $hasCallback): 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