Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents a7b4baa + cbc28e3 commit 6c5eceb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ExecutableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function addSuffix(string $suffix)
* @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
{
if (\ini_get('open_basedir')) {
$searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
Expand Down
2 changes: 1 addition & 1 deletion InputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class InputStream implements \IteratorAggregate
*
* @return void
*/
public function onEmpty(callable $onEmpty = null)
public function onEmpty(?callable $onEmpty = null)
{
$this->onEmpty = $onEmpty;
}
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,15 +50,15 @@ 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));
}

/**
* @return void
*/
public function start(callable $callback = null, array $env = [])
public function start(?callable $callback = null, array $env = [])
{
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 @@ -187,7 +187,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 @@ -242,7 +242,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 @@ -261,7 +261,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 @@ -291,7 +291,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 = [])
public function start(?callable $callback = null, array $env = [])
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
Expand Down Expand Up @@ -380,7 +380,7 @@ public function start(callable $callback = null, array $env = [])
*
* @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 @@ -407,7 +407,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 @@ -880,7 +880,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 @@ -1258,7 +1258,7 @@ private function getDescriptors(): 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 @@ -1552,7 +1552,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 @@ -1565,7 +1565,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 6c5eceb

Please sign in to comment.