Skip to content

Commit bf2a95a

Browse files
Merge branch '7.0' into 7.1
* 7.0: List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters 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 [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2 parents ce6ad28 + 937a195 commit bf2a95a

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function addSuffix(string $suffix): void
4444
* @param string|null $default The default to return if no executable is found
4545
* @param array $extraDirs Additional dirs to check into
4646
*/
47-
public function find(string $name, string $default = null, array $extraDirs = []): ?string
47+
public function find(string $name, ?string $default = null, array $extraDirs = []): ?string
4848
{
4949
$dirs = array_merge(
5050
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),

InputStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class InputStream implements \IteratorAggregate
2929
/**
3030
* Sets a callback that is called when the write buffer becomes empty.
3131
*/
32-
public function onEmpty(callable $onEmpty = null): void
32+
public function onEmpty(?callable $onEmpty = null): void
3333
{
3434
$this->onEmpty = null !== $onEmpty ? $onEmpty(...) : null;
3535
}

PhpProcess.php

Lines changed: 3 additions & 3 deletions
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,12 +50,12 @@ 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

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

PhpSubprocess.php

Lines changed: 3 additions & 3 deletions
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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

Tests/ProcessTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ public function testNotTerminableInputPipe()
16091609
$this->assertFalse($process->isRunning());
16101610
}
16111611

1612-
private function getProcess(string|array $commandline, string $cwd = null, array $env = null, mixed $input = null, ?int $timeout = 60): Process
1612+
private function getProcess(string|array $commandline, ?string $cwd = null, ?array $env = null, mixed $input = null, ?int $timeout = 60): Process
16131613
{
16141614
if (\is_string($commandline)) {
16151615
$process = Process::fromShellCommandline($commandline, $cwd, $env, $input, $timeout);
@@ -1622,7 +1622,7 @@ private function getProcess(string|array $commandline, string $cwd = null, array
16221622
return self::$process = $process;
16231623
}
16241624

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

0 commit comments

Comments
 (0)