minor #32273 [Process] [5.0] Replace docblocks by type-hints (Philippe 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 https://github.com/symfony/symfony/pull/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
-------

5c964c5554 [Process] [5.0] Replace docblocks by type-hints
This commit is contained in:
Fabien Potencier 2019-07-05 07:05:03 +02:00
commit 7eb0912e4b
7 changed files with 15 additions and 27 deletions

View File

@ -31,10 +31,8 @@ class ExecutableFinder
/**
* 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 @@ class ExecutableFinder
*
* @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);

View File

@ -29,11 +29,9 @@ class PhpExecutableFinder
/**
* 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)) {

View File

@ -44,7 +44,7 @@ interface PipesInterface
*
* @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.

View File

@ -89,7 +89,7 @@ class UnixPipes extends AbstractPipes
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false)
public function readAndWrite(bool $blocking, bool $close = false)
{
$this->unblock();
$w = $this->write();

View File

@ -126,7 +126,7 @@ class WindowsPipes extends AbstractPipes
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false)
public function readAndWrite(bool $blocking, bool $close = false)
{
$this->unblock();
$w = $this->write();

View File

@ -495,7 +495,7 @@ class Process implements \IteratorAggregate
* @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 @@ class Process implements \IteratorAggregate
*
* @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 @@ class Process implements \IteratorAggregate
/**
* 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 @@ class Process implements \IteratorAggregate
/**
* 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 @@ class Process implements \IteratorAggregate
/**
* 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 @@ class Process implements \IteratorAggregate
/**
* 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 @@ class Process implements \IteratorAggregate
*
* @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;

View File

@ -39,7 +39,7 @@ class ProcessUtils
*
* @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)) {