Skip to content

Commit 0d38e48

Browse files
Ensure all properties have a type
1 parent 8f38ed0 commit 0d38e48

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

Pipes/AbstractPipes.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ abstract class AbstractPipes implements PipesInterface
2323
public array $pipes = [];
2424

2525
private string $inputBuffer = '';
26+
/** @var resource|string|\Iterator */
2627
private $input;
2728
private bool $blocked = true;
2829
private ?string $lastError = null;
2930

3031
/**
31-
* @param resource|string|int|float|bool|\Iterator|null $input
32+
* @param resource|string|\Iterator $input
3233
*/
33-
public function __construct(mixed $input)
34+
public function __construct($input)
3435
{
3536
if (\is_resource($input) || $input instanceof \Iterator) {
3637
$this->input = $input;
37-
} elseif (\is_string($input)) {
38-
$this->inputBuffer = $input;
3938
} else {
4039
$this->inputBuffer = (string) $input;
4140
}

Process.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Process implements \IteratorAggregate
5454
private array|string $commandline;
5555
private ?string $cwd;
5656
private array $env = [];
57+
/** @var resource|string|\Iterator|null */
5758
private $input;
5859
private ?float $starttime = null;
5960
private ?float $lastOutputTime = null;
@@ -63,8 +64,11 @@ class Process implements \IteratorAggregate
6364
private array $fallbackStatus = [];
6465
private array $processInformation;
6566
private bool $outputDisabled = false;
67+
/** @var resource */
6668
private $stdout;
69+
/** @var resource */
6770
private $stderr;
71+
/** @var resource|null */
6872
private $process;
6973
private string $status = self::STATUS_READY;
7074
private int $incrementalOutputOffset = 0;
@@ -345,11 +349,12 @@ public function start(callable $callback = null, array $env = [])
345349
throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
346350
}
347351

348-
$this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
352+
$process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
349353

350-
if (!\is_resource($this->process)) {
354+
if (!\is_resource($process)) {
351355
throw new RuntimeException('Unable to launch a new process.');
352356
}
357+
$this->process = $process;
353358
$this->status = self::STATUS_STARTED;
354359

355360
if (isset($descriptors[3])) {
@@ -1118,7 +1123,7 @@ public function getInput()
11181123
*
11191124
* This content will be passed to the underlying process standard input.
11201125
*
1121-
* @param string|int|float|bool|resource|\Traversable|null $input The content
1126+
* @param string|resource|\Traversable|self|null $input The content
11221127
*
11231128
* @return $this
11241129
*

ProcessUtils.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public static function validateInput(string $caller, mixed $input): mixed
4343
if (\is_resource($input)) {
4444
return $input;
4545
}
46-
if (\is_string($input)) {
47-
return $input;
48-
}
4946
if (\is_scalar($input)) {
5047
return (string) $input;
5148
}

0 commit comments

Comments
 (0)