Skip to content

[Process] [5.0] Replace docblocks by type-hints #32273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/Symfony/Component/Process/ExecutableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ public function setSuffixes(array $suffixes)

/**
* Adds new possible suffix to check for executable.
*
* @param string $suffix
*/
public function addSuffix($suffix)
public function addSuffix(string $suffix)
{
$this->suffixes[] = $suffix;
}
Expand All @@ -48,7 +46,7 @@ public function addSuffix($suffix)
*
* @return string|null The executable path or default value
*/
public function find($name, $default = null, array $extraDirs = [])
public function find(string $name, string $default = null, array $extraDirs = [])
{
if (ini_get('open_basedir')) {
$searchPath = array_merge(explode(PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Process/PhpExecutableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ public function __construct()
/**
* Finds The PHP executable.
*
* @param bool $includeArgs Whether or not include command arguments
*
* @return string|false The PHP executable path or false if it cannot be found
*/
public function find($includeArgs = true)
public function find(bool $includeArgs = true)
{
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Pipes/PipesInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getFiles();
*
* @return string[] An array of read data indexed by their fd
*/
public function readAndWrite($blocking, $close = false);
public function readAndWrite(bool $blocking, bool $close = false);

/**
* Returns if the current state has open file handles or pipes.
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Pipes/UnixPipes.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getFiles()
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false)
public function readAndWrite(bool $blocking, bool $close = false)
{
$this->unblock();
$w = $this->write();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Pipes/WindowsPipes.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getFiles()
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false)
public function readAndWrite(bool $blocking, bool $close = false)
{
$this->unblock();
$w = $this->write();
Expand Down
24 changes: 8 additions & 16 deletions src/Symfony/Component/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,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($signal)
public function signal(int $signal)
{
$this->doSignal($signal, true);

Expand Down Expand Up @@ -897,7 +897,7 @@ public function getStatus()
*
* @return int The exit-code of the process
*/
public function stop($timeout = 10, $signal = null)
public function stop(float $timeout = 10, int $signal = null)
{
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
Expand Down Expand Up @@ -1028,13 +1028,11 @@ public function setIdleTimeout($timeout)
/**
* Enables or disables the TTY mode.
*
* @param bool $tty True to enabled and false to disable
*
* @return self The current Process instance
*
* @throws RuntimeException In case the TTY mode is not supported
*/
public function setTty($tty)
public function setTty(bool $tty)
{
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
Expand Down Expand Up @@ -1062,13 +1060,11 @@ public function isTty()
/**
* Sets PTY mode.
*
* @param bool $bool
*
* @return self
*/
public function setPty($bool)
public function setPty(bool $bool)
{
$this->pty = (bool) $bool;
$this->pty = $bool;

return $this;
}
Expand Down Expand Up @@ -1102,11 +1098,9 @@ public function getWorkingDirectory()
/**
* Sets the current working directory.
*
* @param string $cwd The new working directory
*
* @return self The current Process instance
*/
public function setWorkingDirectory($cwd)
public function setWorkingDirectory(string $cwd)
{
$this->cwd = $cwd;

Expand Down Expand Up @@ -1185,11 +1179,9 @@ public function setInput($input)
/**
* Sets whether environment variables will be inherited or not.
*
* @param bool $inheritEnv
*
* @return self The current Process instance
*/
public function inheritEnvironmentVariables($inheritEnv = true)
public function inheritEnvironmentVariables(bool $inheritEnv = true)
{
if (!$inheritEnv) {
throw new InvalidArgumentException('Not inheriting environment variables is not supported.');
Expand Down Expand Up @@ -1316,7 +1308,7 @@ protected function buildCallback(callable $callback = null)
*
* @param bool $blocking Whether to use a blocking read call
*/
protected function updateStatus($blocking)
protected function updateStatus(bool $blocking)
{
if (self::STATUS_STARTED !== $this->status) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/ProcessUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function __construct()
*
* @throws InvalidArgumentException In case the input is not valid
*/
public static function validateInput($caller, $input)
public static function validateInput(string $caller, $input)
{
if (null !== $input) {
if (\is_resource($input)) {
Expand Down