10000 minor #32273 [Process] [5.0] Replace docblocks by type-hints (Philipp… · symfony/symfony@7eb0912 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7eb0912

Browse files
committed
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 #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
2 parents fb3d92d + 5c964c5 commit 7eb0912

File tree

7 files changed

+15
-27
lines changed

7 files changed

+15
-27
lines changed

src/Symfony/Component/Process/ExecutableFinder.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ public function setSuffixes(array $suffixes)
3131

3232
/**
3333
* Adds new possible suffix to check for executable.
34-
*
35-
* @param string $suffix
3634
*/
37-
public function addSuffix($suffix)
35+
public function addSuffix(string $suffix)
3836
{
3937
$this->suffixes[] = $suffix;
4038
}
@@ -48,7 +46,7 @@ public function addSuffix($suffix)
4846
*
4947
* @return string|null The executable path or default value
5048
*/
51-
public function find($name, $default = null, array $extraDirs = [])
49+
public function find(string $name, string $default = null, array $extraDirs = [])
5250
{
5351
if (ini_get('open_basedir')) {
5452
$searchPath = array_merge(explode(PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);

src/Symfony/Component/Process/PhpExecutableFinder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ public function __construct()
2929
/**
3030
* Finds The PHP executable.
3131
*
32-
* @param bool $includeArgs Whether or not include command arguments
33-
*
3432
* @return string|false The PHP executable path or false if it cannot be found
3533
*/
36-
public function find($includeArgs = true)
34+
public function find(bool $includeArgs = true)
3735
{
3836
if ($php = getenv('PHP_BINARY')) {
3937
if (!is_executable($php)) {

src/Symfony/Component/Process/Pipes/PipesInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getFiles();
4444
*
4545
* @return string[] An array of read data indexed by their fd
4646
*/
47-
public function readAndWrite($blocking, $close = false);
47+
public function readAndWrite(bool $blocking, bool $close = false);
4848

4949
/**
5050
* Returns if the current state has open file handles or pipes.

src/Symfony/Component/Process/Pipes/UnixPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function getFiles()
8989
/**
9090
* {@inheritdoc}
9191
*/
92-
public function readAndWrite($blocking, $close = false)
92+
public function readAndWrite(bool $blocking, bool $close = false)
9393
{
9494
$this->unblock();
9595
$w = $this->write();

src/Symfony/Component/Process/Pipes/WindowsPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getFiles()
126126
/**
127127
* {@inheritdoc}
128128
*/
129-
public function readAndWrite($blocking, $close = false)
129+
public function readAndWrite(bool $blocking, bool $close = false)
130130
{
131131
$this->unblock();
132132
$w = $this->write();

src/Symfony/Component/Process/Process.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ public function getPid()
495495
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
496496
* @throws RuntimeException In case of failure
497497
*/
498-
public function signal($signal)
498+
public function signal(int $signal)
499499
{
500500
$this->doSignal($signal, true);
501501

@@ -897,7 +897,7 @@ public function getStatus()
897897
*
898898
* @return int The exit-code of the process
899899
*/
900-
public function stop($timeout = 10, $signal = null)
900+
public function stop(float $timeout = 10, int $signal = null)
901901
{
902902
$timeoutMicro = microtime(true) + $timeout;
903903< 9E7A code class="diff-text syntax-highlighted-line">
if ($this->isRunning()) {
@@ -1028,13 +1028,11 @@ public function setIdleTimeout($timeout)
10281028
/**
10291029
* Enables or disables the TTY mode.
10301030
*
1031-
* @param bool $tty True to enabled and false to disable
1032-
*
10331031
* @return self The current Process instance
10341032
*
10351033
* @throws RuntimeException In case the TTY mode is not supported
10361034
*/
1037-
public function setTty($tty)
1035+
public function setTty(bool $tty)
10381036
{
10391037
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
10401038
throw new RuntimeException('TTY mode is not supported on Windows platform.');
@@ -1062,13 +1060,11 @@ public function isTty()
10621060
/**
10631061
* Sets PTY mode.
10641062
*
1065-
* @param bool $bool
1066-
*
10671063
* @return self
10681064
*/
1069-
public function setPty($bool)
1065+
public function setPty(bool $bool)
10701066
{
1071-
$this->pty = (bool) $bool;
1067+
$this->pty = $bool;
10721068

10731069
return $this;
10741070
}
@@ -1102,11 +1098,9 @@ public function getWorkingDirectory()
11021098
/**
11031099
* Sets the current working directory.
11041100
*
1105-
* @param string $cwd The new working directory
1106-
*
11071101
* @return self The current Process instance
11081102
*/
1109-
public function setWorkingDirectory($cwd)
1103+
public function setWorkingDirectory(string $cwd)
11101104
{
11111105
$this->cwd = $cwd;
11121106

@@ -1185,11 +1179,9 @@ public function setInput($input)
11851179
/**
11861180
* Sets whether environment variables will be inherited or not.
11871181
*
1188-
* @param bool $inheritEnv
1189-
*
11901182
* @return self The current Process instance
11911183
*/
1192-
public function inheritEnvironmentVariables($inheritEnv = true)
1184+
public function inheritEnvironmentVariables(bool $inheritEnv = true)
11931185
{
11941186
if (!$inheritEnv) {
11951187
throw new InvalidArgumentException('Not inheriting environment variables is not supported.');
@@ -1316,7 +1308,7 @@ protected function buildCallback(callable $callback = null)
13161308
*
13171309
* @param bool $blocking Whether to use a blocking read call
13181310
*/
1319-
protected function updateStatus($blocking)
1311+
protected function updateStatus(bool $blocking)
13201312
{
13211313
if (self::STATUS_STARTED !== $this->status) {
13221314
return;

src/Symfony/Component/Process/ProcessUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private function __construct()
3939
*
4040
* @throws InvalidArgumentException In case the input is not valid
4141
*/
42-
public static function validateInput($caller, $input)
42+
public static function validateInput(string $caller, $input)
4343
{
4444
if (null !== $input) {
4545
if (\is_resource($input)) {

0 commit comments

Comments
 (0)
0