Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  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
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents c9920b0 + 31642b0 commit 937a195
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ExecutableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function addSuffix(string $suffix): void
* @param string|null $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*/
public function find(string $name, string $default = null, array $extraDirs = []): ?string
public function find(string $name, ?string $default = null, array $extraDirs = []): ?string
{
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
Expand Down
2 changes: 1 addition & 1 deletion InputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InputStream implements \IteratorAggregate
/**
* Sets a callback that is called when the write buffer becomes empty.
*/
public function onEmpty(callable $onEmpty = null): void
public function onEmpty(?callable $onEmpty = null): void
{
$this->onEmpty = null !== $onEmpty ? $onEmpty(...) : null;
}
Expand Down
6 changes: 3 additions & 3 deletions PhpProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PhpProcess extends Process
* @param int $timeout The timeout in seconds
* @param array|null $php Path to the PHP binary to use with any additional arguments
*/
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
Expand All @@ -50,12 +50,12 @@ public function __construct(string $script, string $cwd = null, array $env = nul
parent::__construct($php, $cwd, $env, $script, $timeout);
}

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

public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
Expand Down
6 changes: 3 additions & 3 deletions PhpSubprocess.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PhpSubprocess extends Process
* @param int $timeout The timeout in seconds
* @param array|null $php Path to the PHP binary to use with any additional arguments
*/
public function __construct(array $command, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
public function __construct(array $command, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
Expand All @@ -73,12 +73,12 @@ public function __construct(array $command, string $cwd = null, array $env = nul
parent::__construct($command, $cwd, $env, null, $timeout);
}

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

public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
Expand Down
18 changes: 9 additions & 9 deletions Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Process implements \IteratorAggregate
*
* @throws LogicException When proc_open is not installed
*/
public function __construct(array $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60)
public function __construct(array $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60)
{
if (!\function_exists('proc_open')) {
throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
Expand Down Expand Up @@ -186,7 +186,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
*
* @throws LogicException When proc_open is not installed
*/
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
{
$process = new static([], $cwd, $env, $input, $timeout);
$process->commandline = $command;
Expand Down Expand Up @@ -241,7 +241,7 @@ public function __clone()
*
* @final
*/
public function run(callable $callback = null, array $env = []): int
public function run(?callable $callback = null, array $env = []): int
{
$this->start($callback, $env);

Expand All @@ -260,7 +260,7 @@ public function run(callable $callback = null, array $env = []): int
*
* @final
*/
public function mustRun(callable $callback = null, array $env = []): static
public function mustRun(?callable $callback = null, array $env = []): static
{
if (0 !== $this->run($callback, $env)) {
throw new ProcessFailedException($this);
Expand Down Expand Up @@ -288,7 +288,7 @@ public function mustRun(callable $callback = null, array $env = []): static
* @throws RuntimeException When process is already running
* @throws LogicException In case a callback is provided and output has been disabled
*/
public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
Expand Down Expand Up @@ -373,7 +373,7 @@ public function start(callable $callback = null, array $env = []): void
*
* @final
*/
public function restart(callable $callback = null, array $env = []): static
public function restart(?callable $callback = null, array $env = []): static
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
Expand All @@ -400,7 +400,7 @@ public function restart(callable $callback = null, array $env = []): static
* @throws ProcessSignaledException When process stopped after receiving signal
* @throws LogicException When process is not yet started
*/
public function wait(callable $callback = null): int
public function wait(?callable $callback = null): int
{
$this->requireProcessIsStarted(__FUNCTION__);

Expand Down Expand Up @@ -873,7 +873,7 @@ public function getStatus(): string
*
* @return int|null The exit-code of the process or null if it's not running
*/
public function stop(float $timeout = 10, int $signal = null): ?int
public function stop(float $timeout = 10, ?int $signal = null): ?int
{
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
Expand Down Expand Up @@ -1247,7 +1247,7 @@ private function getDescriptors(bool $hasCallback): array
*
* @param callable|null $callback The user defined PHP callback
*/
protected function buildCallback(callable $callback = null): \Closure
protected function buildCallback(?callable $callback = null): \Closure
{
if ($this->outputDisabled) {
return fn ($type, $data): bool => null !== $callback && $callback($type, $data);
Expand Down
4 changes: 2 additions & 2 deletions Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ public function testNotTerminableInputPipe()
$this->assertFalse($process->isRunning());
}

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

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

0 comments on commit 937a195

Please sign in to comment.