Skip to content
Permalink
Browse files

minor #32273 [Process] [5.0] Replace docblocks by type-hints (Philipp…

…e Segatori, tigitz)

This PR was squashed before being merged into the 5.0-dev branch (closes #32273).

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | continuation of #24722 and checks for  #32179
| License       | MIT
| Doc PR        | N/A

This PR adds replace docblocks by type hints in the Process component. Some docblocks without valuable information got also removed.

Commits
-------

5c964c5 [Process] [5.0] Replace docblocks by type-hints
  • Loading branch information...
fabpot committed Jul 5, 2019
2 parents fb3d92d + 5c964c5 commit 7eb0912e4bf2a96bbbe2241386f05e7f01ae819b
@@ -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;
}
@@ -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);
@@ -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)) {
@@ -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.
@@ -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();
@@ -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();
@@ -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);
@@ -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()) {
@@ -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.');
@@ -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;
}
@@ -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;
@@ -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.');
@@ -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;
@@ -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)) {

0 comments on commit 7eb0912

Please sign in to comment.
You can’t perform that action at this time.