Skip to content

Commit 31642b0

Browse files
Merge branch '6.3' into 6.4
* 6.3: minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench) Fix bad merge List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
2 parents d33b31f + 6c5eceb commit 31642b0

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

ExecutableFinder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function addSuffix(string $suffix)
4848
* @param string|null $default The default to return if no executable is found
4949
* @param array $extraDirs Additional dirs to check into
5050
*/
51-
public function find(string $name, string $default = null, array $extraDirs = []): ?string
51+
public function find(string $name, ?string $default = null, array $extraDirs = []): ?string
5252
{
5353
$dirs = array_merge(
5454
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),

InputStream.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class InputStream implements \IteratorAggregate
3131
*
3232
* @return void
3333
*/
34-
public function onEmpty(callable $onEmpty = null)
34+
public function onEmpty(?callable $onEmpty = null)
3535
{
3636
$this->onEmpty = null !== $onEmpty ? $onEmpty(...) : null;
3737
}

PhpProcess.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PhpProcess extends Process
3232
* @param int $timeout The timeout in seconds
3333
* @param array|null $php Path to the PHP binary to use with any additional arguments
3434
*/
35-
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
35+
public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
3636
{
3737
if (null === $php) {
3838
$executableFinder = new PhpExecutableFinder();
@@ -50,15 +50,15 @@ public function __construct(string $script, string $cwd = null, array $env = nul
5050
parent::__construct($php, $cwd, $env, $script, $timeout);
5151
}
5252

53-
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
53+
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
5454
{
5555
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
5656
}
5757

5858
/**
5959
* @return void
6060
*/
61-
public function start(callable $callback = null, array $env = [])
61+
public function start(?callable $callback = null, array $env = [])
6262
{
6363
if (null === $this->getCommandLine()) {
6464
throw new RuntimeException('Unable to find the PHP executable.');

PhpSubprocess.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class PhpSubprocess extends Process
5151
* @param int $timeout The timeout in seconds
5252
* @param array|null $php Path to the PHP binary to use with any additional arguments
5353
*/
54-
public function __construct(array $command, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
54+
public function __construct(array $command, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
5555
{
5656
if (null === $php) {
5757
$executableFinder = new PhpExecutableFinder();
@@ -73,12 +73,12 @@ public function __construct(array $command, string $cwd = null, array $env = nul
7373
parent::__construct($command, $cwd, $env, null, $timeout);
7474
}
7575

76-
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
76+
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
7777
{
7878
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
7979
}
8080

81-
public function start(callable $callback = null, array $env = []): void
81+
public function start(?callable $callback = null, array $env = []): void
8282
{
8383
if (null === $this->getCommandLine()) {
8484
throw new RuntimeException('Unable to find the PHP executable.');

Process.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -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);

Tests/ProcessTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ public function testNotTerminableInputPipe()
15661566
$this->assertFalse($process->isRunning());
15671567
}
15681568

1569-
private function getProcess(string|array $commandline, string $cwd = null, array $env = null, mixed $input = null, ?int $timeout = 60): Process
1569+
private function getProcess(string|array $commandline, ?string $cwd = null, ?array $env = null, mixed $input = null, ?int $timeout = 60): Process
15701570
{
15711571
if (\is_string($commandline)) {
15721572
$process = Process::fromShellCommandline($commandline, $cwd, $env, $input, $timeout);
@@ -1579,7 +1579,7 @@ private function getProcess(string|array $commandline, string $cwd = null, array
15791579
return self::$process = $process;
15801580
}
15811581

1582-
private function getProcessForCode(string $code, string $cwd = null, array $env = null, $input = null, ?int $timeout = 60): Process
1582+
private function getProcessForCode(string $code, ?string $cwd = null, ?array $env = null, $input = null, ?int $timeout = 60): Process
15831583
{
15841584
return $this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout);
15851585
}

0 commit comments

Comments
 (0)