Skip to content

Commit

Permalink
[Process] [5.0] Replace docblocks by type-hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Segatori authored and fabpot committed Jul 5, 2019
1 parent aac5765 commit 5c964c5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 27 deletions.
6 changes: 2 additions & 4 deletions src/Symfony/Component/Process/ExecutableFinder.php
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
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
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
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
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
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
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

0 comments on commit 5c964c5

Please sign in to comment.