From 2ad752b7ac0e488beaa4555df0320f60c93571d8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 19 May 2021 15:18:37 +0200 Subject: [PATCH 01/10] Bump Symfony 6 to PHP 8 --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d90078c3..9f1aa8cf 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ } ], "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "php": ">=8.0.2" }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" }, From 4a56cc900fabeaa3bf7f4295a36d21cfd307abd9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Jun 2021 18:09:43 +0200 Subject: [PATCH 02/10] Update phpunit.xml.dist files for phpunit >= 9.3 --- phpunit.xml.dist | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c32f2510..13bd3f83 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ - - + + ./ - - ./Tests - ./vendor - - - + + + ./Tests + ./vendor + + From 25fc22d2608595d8f90fab042b354a36cf55fffd Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 27 May 2021 19:18:44 +0200 Subject: [PATCH 03/10] Add union types --- InputStream.php | 2 +- PhpProcess.php | 2 +- Pipes/AbstractPipes.php | 4 ++-- Pipes/UnixPipes.php | 2 +- Pipes/WindowsPipes.php | 2 +- Process.php | 6 +++--- ProcessUtils.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/InputStream.php b/InputStream.php index c86fca86..4a6811aa 100644 --- a/InputStream.php +++ b/InputStream.php @@ -39,7 +39,7 @@ public function onEmpty(callable $onEmpty = null) * @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar, * stream resource or \Traversable */ - public function write($input) + public function write(mixed $input) { if (null === $input) { return; diff --git a/PhpProcess.php b/PhpProcess.php index 2bc338e5..d5d08845 100644 --- a/PhpProcess.php +++ b/PhpProcess.php @@ -53,7 +53,7 @@ public function __construct(string $script, string $cwd = null, array $env = nul /** * {@inheritdoc} */ - public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) + public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60) { throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class)); } diff --git a/Pipes/AbstractPipes.php b/Pipes/AbstractPipes.php index 77636c2a..1d37eb76 100644 --- a/Pipes/AbstractPipes.php +++ b/Pipes/AbstractPipes.php @@ -30,7 +30,7 @@ abstract class AbstractPipes implements PipesInterface /** * @param resource|string|int|float|bool|\Iterator|null $input */ - public function __construct($input) + public function __construct(mixed $input) { if (\is_resource($input) || $input instanceof \Iterator) { $this->input = $input; @@ -171,7 +171,7 @@ protected function write(): ?array /** * @internal */ - public function handleError($type, $msg) + public function handleError(int $type, string $msg) { $this->lastError = $msg; } diff --git a/Pipes/UnixPipes.php b/Pipes/UnixPipes.php index 7cb5bab7..0081f932 100644 --- a/Pipes/UnixPipes.php +++ b/Pipes/UnixPipes.php @@ -26,7 +26,7 @@ class UnixPipes extends AbstractPipes private $ptyMode; private $haveReadSupport; - public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport) + public function __construct(?bool $ttyMode, bool $ptyMode, mixed $input, bool $haveReadSupport) { $this->ttyMode = $ttyMode; $this->ptyMode = $ptyMode; diff --git a/Pipes/WindowsPipes.php b/Pipes/WindowsPipes.php index 3a1ef405..611f7ae5 100644 --- a/Pipes/WindowsPipes.php +++ b/Pipes/WindowsPipes.php @@ -35,7 +35,7 @@ class WindowsPipes extends AbstractPipes ]; private $haveReadSupport; - public function __construct($input, bool $haveReadSupport) + public function __construct(mixed $input, bool $haveReadSupport) { $this->haveReadSupport = $haveReadSupport; diff --git a/Process.php b/Process.php index 877f16cd..da1514c0 100644 --- a/Process.php +++ b/Process.php @@ -138,7 +138,7 @@ class Process implements \IteratorAggregate * * @throws LogicException When proc_open is not installed */ - public function __construct(array $command, string $cwd = null, array $env = null, $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.'); @@ -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, $input = null, ?float $timeout = 60) + public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60) { $process = new static([], $cwd, $env, $input, $timeout); $process->commandline = $command; @@ -1182,7 +1182,7 @@ public function getInput() * * @throws LogicException In case the process is running */ - public function setInput($input) + public function setInput(mixed $input) { if ($this->isRunning()) { throw new LogicException('Input can not be set while the process is running.'); diff --git a/ProcessUtils.php b/ProcessUtils.php index 3be7e61a..d5bc4478 100644 --- a/ProcessUtils.php +++ b/ProcessUtils.php @@ -39,7 +39,7 @@ private function __construct() * * @throws InvalidArgumentException In case the input is not valid */ - public static function validateInput(string $caller, $input) + public static function validateInput(string $caller, mixed $input) { if (null !== $input) { if (\is_resource($input)) { From 545332f29b514c66bb6b92ebb4bad007cdfd5d81 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Jul 2021 11:26:55 +0200 Subject: [PATCH 04/10] Add return types, round 1 --- Pipes/UnixPipes.php | 2 +- Pipes/WindowsPipes.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Pipes/UnixPipes.php b/Pipes/UnixPipes.php index 0081f932..063aa6ad 100644 --- a/Pipes/UnixPipes.php +++ b/Pipes/UnixPipes.php @@ -35,7 +35,7 @@ public function __construct(?bool $ttyMode, bool $ptyMode, mixed $input, bool $h parent::__construct($input); } - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/Pipes/WindowsPipes.php b/Pipes/WindowsPipes.php index 611f7ae5..e68ed951 100644 --- a/Pipes/WindowsPipes.php +++ b/Pipes/WindowsPipes.php @@ -88,7 +88,7 @@ public function __construct(mixed $input, bool $haveReadSupport) parent::__construct($input); } - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } From e96c4f6dee4e49fb849debe833aba0a8b68d5e69 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 21 Jul 2021 12:04:28 +0200 Subject: [PATCH 05/10] Narrow existing return types on private/internal/final/test methods --- Process.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Process.php b/Process.php index a2fdb71d..e7ed10ed 100644 --- a/Process.php +++ b/Process.php @@ -258,13 +258,11 @@ public function run(callable $callback = null, array $env = []): int * This is identical to run() except that an exception is thrown if the process * exits with a non-zero exit code. * - * @return $this - * * @throws ProcessFailedException if the process didn't terminate successfully * * @final */ - public function mustRun(callable $callback = null, array $env = []): self + public function mustRun(callable $callback = null, array $env = []): static { if (0 !== $this->run($callback, $env)) { throw new ProcessFailedException($this); @@ -374,8 +372,6 @@ public function start(callable $callback = null, array $env = []) * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR * - * @return static - * * @throws RuntimeException When process can't be launched * @throws RuntimeException When process is already running * @@ -383,7 +379,7 @@ public function start(callable $callback = null, array $env = []) * * @final */ - public function restart(callable $callback = null, array $env = []): self + public function restart(callable $callback = null, array $env = []): static { if ($this->isRunning()) { throw new RuntimeException('Process is already running.'); From d5052fc2a90891954a5d469fb3a9b9905b2fd6ed Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 5 Aug 2021 00:33:39 +0200 Subject: [PATCH 06/10] Remove ReturnTypeWillChange Signed-off-by: Alexander M. Turek --- InputStream.php | 6 +----- Process.php | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/InputStream.php b/InputStream.php index d4730d63..d970ccd1 100644 --- a/InputStream.php +++ b/InputStream.php @@ -66,11 +66,7 @@ public function isClosed() return !$this->open; } - /** - * @return \Traversable - */ - #[\ReturnTypeWillChange] - public function getIterator() + public function getIterator(): \Traversable { $this->open = true; diff --git a/Process.php b/Process.php index e7ed10ed..aa64e050 100644 --- a/Process.php +++ b/Process.php @@ -613,11 +613,8 @@ public function getIncrementalOutput() * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return \Generator */ - #[\ReturnTypeWillChange] - public function getIterator(int $flags = 0) + public function getIterator(int $flags = 0): \Generator { $this->readPipesForOutput(__FUNCTION__, false); From 03ee97adf3a53fec824499b3731f7db82ca5d610 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 12 Aug 2021 17:01:43 +0200 Subject: [PATCH 07/10] Add return types - batch 2/n --- ExecutableFinder.php | 2 +- PhpExecutableFinder.php | 4 +- PhpProcess.php | 2 +- Process.php | 86 ++++++++++++++++++++--------------------- ProcessUtils.php | 2 +- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/ExecutableFinder.php b/ExecutableFinder.php index feee4ad4..849a7241 100644 --- a/ExecutableFinder.php +++ b/ExecutableFinder.php @@ -46,7 +46,7 @@ public function addSuffix(string $suffix) * * @return string|null The executable path or default value */ - public function find(string $name, string $default = null, array $extraDirs = []) + 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); diff --git a/PhpExecutableFinder.php b/PhpExecutableFinder.php index e4f03f76..a32f948b 100644 --- a/PhpExecutableFinder.php +++ b/PhpExecutableFinder.php @@ -31,7 +31,7 @@ public function __construct() * * @return string|false The PHP executable path or false if it cannot be found */ - public function find(bool $includeArgs = true) + public function find(bool $includeArgs = true): string|false { if ($php = getenv('PHP_BINARY')) { if (!is_executable($php)) { @@ -87,7 +87,7 @@ public function find(bool $includeArgs = true) * * @return array The PHP executable arguments */ - public function findArguments() + public function findArguments(): array { $arguments = []; if ('phpdbg' === \PHP_SAPI) { diff --git a/PhpProcess.php b/PhpProcess.php index d5d08845..cb749f9b 100644 --- a/PhpProcess.php +++ b/PhpProcess.php @@ -53,7 +53,7 @@ public function __construct(string $script, string $cwd = null, array $env = nul /** * {@inheritdoc} */ - public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60) + 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)); } diff --git a/Process.php b/Process.php index aa64e050..cf40fc89 100644 --- a/Process.php +++ b/Process.php @@ -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) + 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; @@ -198,7 +198,7 @@ public static function fromShellCommandline(string $command, string $cwd = null, /** * @return array */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } @@ -406,7 +406,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) + public function wait(callable $callback = null): int { $this->requireProcessIsStarted(__FUNCTION__); @@ -489,7 +489,7 @@ public function waitUntil(callable $callback): bool * * @return int|null The process id if running, null otherwise */ - public function getPid() + public function getPid(): ?int { return $this->isRunning() ? $this->processInformation['pid'] : null; } @@ -505,7 +505,7 @@ public function getPid() * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed * @throws RuntimeException In case of failure */ - public function signal(int $signal) + public function signal(int $signal): static { $this->doSignal($signal, true); @@ -520,7 +520,7 @@ public function signal(int $signal) * @throws RuntimeException In case the process is already running * @throws LogicException if an idle timeout is set */ - public function disableOutput() + public function disableOutput(): static { if ($this->isRunning()) { throw new RuntimeException('Disabling output while the process is running is not possible.'); @@ -541,7 +541,7 @@ public function disableOutput() * * @throws RuntimeException In case the process is already running */ - public function enableOutput() + public function enableOutput(): static { if ($this->isRunning()) { throw new RuntimeException('Enabling output while the process is running is not possible.'); @@ -557,7 +557,7 @@ public function enableOutput() * * @return bool */ - public function isOutputDisabled() + public function isOutputDisabled(): bool { return $this->outputDisabled; } @@ -570,7 +570,7 @@ public function isOutputDisabled() * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started */ - public function getOutput() + public function getOutput(): string { $this->readPipesForOutput(__FUNCTION__); @@ -592,7 +592,7 @@ public function getOutput() * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started */ - public function getIncrementalOutput() + public function getIncrementalOutput(): string { $this->readPipesForOutput(__FUNCTION__); @@ -666,7 +666,7 @@ public function getIterator(int $flags = 0): \Generator * * @return $this */ - public function clearOutput() + public function clearOutput(): static { ftruncate($this->stdout, 0); fseek($this->stdout, 0); @@ -683,7 +683,7 @@ public function clearOutput() * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started */ - public function getErrorOutput() + public function getErrorOutput(): string { $this->readPipesForOutput(__FUNCTION__); @@ -706,7 +706,7 @@ public function getErrorOutput() * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started */ - public function getIncrementalErrorOutput() + public function getIncrementalErrorOutput(): string { $this->readPipesForOutput(__FUNCTION__); @@ -725,7 +725,7 @@ public function getIncrementalErrorOutput() * * @return $this */ - public function clearErrorOutput() + public function clearErrorOutput(): static { ftruncate($this->stderr, 0); fseek($this->stderr, 0); @@ -739,7 +739,7 @@ public function clearErrorOutput() * * @return int|null The exit status code, null if the Process is not terminated */ - public function getExitCode() + public function getExitCode(): ?int { $this->updateStatus(false); @@ -757,7 +757,7 @@ public function getExitCode() * @see http://tldp.org/LDP/abs/html/exitcodes.html * @see http://en.wikipedia.org/wiki/Unix_signal */ - public function getExitCodeText() + public function getExitCodeText(): ?string { if (null === $exitcode = $this->getExitCode()) { return null; @@ -771,7 +771,7 @@ public function getExitCodeText() * * @return bool true if the process ended successfully, false otherwise */ - public function isSuccessful() + public function isSuccessful(): bool { return 0 === $this->getExitCode(); } @@ -785,7 +785,7 @@ public function isSuccessful() * * @throws LogicException In case the process is not terminated */ - public function hasBeenSignaled() + public function hasBeenSignaled(): bool { $this->requireProcessIsTerminated(__FUNCTION__); @@ -802,7 +802,7 @@ public function hasBeenSignaled() * @throws RuntimeException In case --enable-sigchild is activated * @throws LogicException In case the process is not terminated */ - public function getTermSignal() + public function getTermSignal(): int { $this->requireProcessIsTerminated(__FUNCTION__); @@ -822,7 +822,7 @@ public function getTermSignal() * * @throws LogicException In case the process is not terminated */ - public function hasBeenStopped() + public function hasBeenStopped(): bool { $this->requireProcessIsTerminated(__FUNCTION__); @@ -838,7 +838,7 @@ public function hasBeenStopped() * * @throws LogicException In case the process is not terminated */ - public function getStopSignal() + public function getStopSignal(): int { $this->requireProcessIsTerminated(__FUNCTION__); @@ -850,7 +850,7 @@ public function getStopSignal() * * @return bool true if the process is currently running, false otherwise */ - public function isRunning() + public function isRunning(): bool { if (self::STATUS_STARTED !== $this->status) { return false; @@ -866,7 +866,7 @@ public function isRunning() * * @return bool true if status is ready, false otherwise */ - public function isStarted() + public function isStarted(): bool { return self::STATUS_READY != $this->status; } @@ -876,7 +876,7 @@ public function isStarted() * * @return bool true if process is terminated, false otherwise */ - public function isTerminated() + public function isTerminated(): bool { $this->updateStatus(false); @@ -890,7 +890,7 @@ public function isTerminated() * * @return string The current process status */ - public function getStatus() + public function getStatus(): string { $this->updateStatus(false); @@ -905,7 +905,7 @@ public function getStatus() * * @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) + public function stop(float $timeout = 10, int $signal = null): ?int { $timeoutMicro = microtime(true) + $timeout; if ($this->isRunning()) { @@ -977,7 +977,7 @@ public function getLastOutputTime(): ?float * * @return string The command to execute */ - public function getCommandLine() + public function getCommandLine(): string { return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline; } @@ -987,7 +987,7 @@ public function getCommandLine() * * @return float|null The timeout in seconds or null if it's disabled */ - public function getTimeout() + public function getTimeout(): ?float { return $this->timeout; } @@ -997,7 +997,7 @@ public function getTimeout() * * @return float|null The timeout in seconds or null if it's disabled */ - public function getIdleTimeout() + public function getIdleTimeout(): ?float { return $this->idleTimeout; } @@ -1011,7 +1011,7 @@ public function getIdleTimeout() * * @throws InvalidArgumentException if the timeout is negative */ - public function setTimeout(?float $timeout) + public function setTimeout(?float $timeout): static { $this->timeout = $this->validateTimeout($timeout); @@ -1028,7 +1028,7 @@ public function setTimeout(?float $timeout) * @throws LogicException if the output is disabled * @throws InvalidArgumentException if the timeout is negative */ - public function setIdleTimeout(?float $timeout) + public function setIdleTimeout(?float $timeout): static { if (null !== $timeout && $this->outputDisabled) { throw new LogicException('Idle timeout can not be set while the output is disabled.'); @@ -1046,7 +1046,7 @@ public function setIdleTimeout(?float $timeout) * * @throws RuntimeException In case the TTY mode is not supported */ - public function setTty(bool $tty) + public function setTty(bool $tty): static { if ('\\' === \DIRECTORY_SEPARATOR && $tty) { throw new RuntimeException('TTY mode is not supported on Windows platform.'); @@ -1066,7 +1066,7 @@ public function setTty(bool $tty) * * @return bool true if the TTY mode is enabled, false otherwise */ - public function isTty() + public function isTty(): bool { return $this->tty; } @@ -1076,7 +1076,7 @@ public function isTty() * * @return $this */ - public function setPty(bool $bool) + public function setPty(bool $bool): static { $this->pty = $bool; @@ -1088,7 +1088,7 @@ public function setPty(bool $bool) * * @return bool */ - public function isPty() + public function isPty(): bool { return $this->pty; } @@ -1098,7 +1098,7 @@ public function isPty() * * @return string|null The current working directory or null on failure */ - public function getWorkingDirectory() + public function getWorkingDirectory(): ?string { if (null === $this->cwd) { // getcwd() will return false if any one of the parent directories does not have @@ -1114,7 +1114,7 @@ public function getWorkingDirectory() * * @return $this */ - public function setWorkingDirectory(string $cwd) + public function setWorkingDirectory(string $cwd): static { $this->cwd = $cwd; @@ -1126,7 +1126,7 @@ public function setWorkingDirectory(string $cwd) * * @return array The current environment variables */ - public function getEnv() + public function getEnv(): array { return $this->env; } @@ -1146,7 +1146,7 @@ public function getEnv() * * @return $this */ - public function setEnv(array $env) + public function setEnv(array $env): static { // Process can not handle env values that are arrays $env = array_filter($env, function ($value) { @@ -1179,7 +1179,7 @@ public function getInput() * * @throws LogicException In case the process is running */ - public function setInput(mixed $input) + public function setInput(mixed $input): static { if ($this->isRunning()) { throw new LogicException('Input can not be set while the process is running.'); @@ -1274,7 +1274,7 @@ public static function isTtySupported(): bool * * @return bool */ - public static function isPtySupported() + public static function isPtySupported(): bool { static $result; @@ -1316,7 +1316,7 @@ private function getDescriptors(): array * * @return \Closure A PHP closure */ - protected function buildCallback(callable $callback = null) + protected function buildCallback(callable $callback = null): \Closure { if ($this->outputDisabled) { return function ($type, $data) use ($callback): bool { @@ -1367,7 +1367,7 @@ protected function updateStatus(bool $blocking) * * @return bool */ - protected function isSigchildEnabled() + protected function isSigchildEnabled(): bool { if (null !== self::$sigchild) { return self::$sigchild; diff --git a/ProcessUtils.php b/ProcessUtils.php index d5bc4478..1d86ad00 100644 --- a/ProcessUtils.php +++ b/ProcessUtils.php @@ -39,7 +39,7 @@ private function __construct() * * @throws InvalidArgumentException In case the input is not valid */ - public static function validateInput(string $caller, mixed $input) + public static function validateInput(string $caller, mixed $input): mixed { if (null !== $input) { if (\is_resource($input)) { From ff98682d5355a5c8fb8a3d293689e7a8c1056aaf Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 16 Aug 2021 18:31:32 +0200 Subject: [PATCH 08/10] Run php-cs-fixer --- Process.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Process.php b/Process.php index cf40fc89..d067284f 100644 --- a/Process.php +++ b/Process.php @@ -183,8 +183,6 @@ public function __construct(array $command, string $cwd = null, array $env = nul * @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input * @param int|float|null $timeout The timeout in seconds or null to disable * - * @return static - * * @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 @@ -195,9 +193,6 @@ public static function fromShellCommandline(string $command, string $cwd = null, return $process; } - /** - * @return array - */ public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); @@ -554,8 +549,6 @@ public function enableOutput(): static /** * Returns true in case the output is disabled, false otherwise. - * - * @return bool */ public function isOutputDisabled(): bool { @@ -781,8 +774,6 @@ public function isSuccessful(): bool * * It always returns false on Windows. * - * @return bool - * * @throws LogicException In case the process is not terminated */ public function hasBeenSignaled(): bool @@ -797,8 +788,6 @@ public function hasBeenSignaled(): bool * * It is only meaningful if hasBeenSignaled() returns true. * - * @return int - * * @throws RuntimeException In case --enable-sigchild is activated * @throws LogicException In case the process is not terminated */ @@ -818,8 +807,6 @@ public function getTermSignal(): int * * It always returns false on Windows. * - * @return bool - * * @throws LogicException In case the process is not terminated */ public function hasBeenStopped(): bool @@ -834,8 +821,6 @@ public function hasBeenStopped(): bool * * It is only meaningful if hasBeenStopped() returns true. * - * @return int - * * @throws LogicException In case the process is not terminated */ public function getStopSignal(): int @@ -1085,8 +1070,6 @@ public function setPty(bool $bool): static /** * Returns PTY state. - * - * @return bool */ public function isPty(): bool { @@ -1271,8 +1254,6 @@ public static function isTtySupported(): bool /** * Returns whether PTY is supported on the current operating system. - * - * @return bool */ public static function isPtySupported(): bool { @@ -1364,8 +1345,6 @@ protected function updateStatus(bool $blocking) /** * Returns whether PHP has been compiled with the '--enable-sigchild' option or not. - * - * @return bool */ protected function isSigchildEnabled(): bool { From 3ecb9b7dcc7b0095bc687c5ce3d35f02ab7f7ca5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 24 Aug 2021 22:21:00 +0200 Subject: [PATCH 09/10] Add back `@return $this` annotations --- Process.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Process.php b/Process.php index 7ef708fa..cd1e920c 100644 --- a/Process.php +++ b/Process.php @@ -253,6 +253,8 @@ public function run(callable $callback = null, array $env = []): int * This is identical to run() except that an exception is thrown if the process * exits with a non-zero exit code. * + * @return $this + * * @throws ProcessFailedException if the process didn't terminate successfully * * @final From 6d4b8b30f502cf098fdeaa2a160d545a2c2d4621 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 5 Oct 2021 17:32:15 +0200 Subject: [PATCH 10/10] Add type to final/internal public/protected properties --- Pipes/AbstractPipes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipes/AbstractPipes.php b/Pipes/AbstractPipes.php index 1d37eb76..dca7ae7f 100644 --- a/Pipes/AbstractPipes.php +++ b/Pipes/AbstractPipes.php @@ -20,7 +20,7 @@ */ abstract class AbstractPipes implements PipesInterface { - public $pipes = []; + public array $pipes = []; private $inputBuffer = ''; private $input;