Skip to content

Commit 6c5eceb

Browse files
Merge branch '5.4' into 6.3
* 5.4: 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 a7b4baa + cbc28e3 commit 6c5eceb

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
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
if (\ini_get('open_basedir')) {
5454
$searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);

InputStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InputStream implements \IteratorAggregate
3232
*
3333
* @return void
3434
*/
35-
public function onEmpty(callable $onEmpty = null)
35+
public function onEmpty(?callable $onEmpty = null)
3636
{
3737
$this->onEmpty = $onEmpty;
3838
}

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,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.');

Process.php

Lines changed: 9 additions & 9 deletions
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.');
@@ -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);

Tests/ProcessTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,7 @@ public function testNotTerminableInputPipe()
15521552
$this->assertFalse($process->isRunning());
15531553
}
15541554

1555-
private function getProcess(string|array $commandline, string $cwd = null, array $env = null, mixed $input = null, ?int $timeout = 60): Process
1555+
private function getProcess(string|array $commandline, ?string $cwd = null, ?array $env = null, mixed $input = null, ?int $timeout = 60): Process
15561556
{
15571557
if (\is_string($commandline)) {
15581558
$process = Process::fromShellCommandline($commandline, $cwd, $env, $input, $timeout);
@@ -1565,7 +1565,7 @@ private function getProcess(string|array $commandline, string $cwd = null, array
15651565
return self::$process = $process;
15661566
}
15671567

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

0 commit comments

Comments
 (0)