Upgrade framework
This commit is contained in:
18
vendor/symfony/process/InputStream.php
vendored
18
vendor/symfony/process/InputStream.php
vendored
@@ -17,11 +17,14 @@ use Symfony\Component\Process\Exception\RuntimeException;
|
||||
* Provides a way to continuously write to the input of a Process until the InputStream is closed.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @implements \IteratorAggregate<int, string>
|
||||
*/
|
||||
class InputStream implements \IteratorAggregate
|
||||
{
|
||||
/** @var callable|null */
|
||||
private $onEmpty = null;
|
||||
private $input = array();
|
||||
private $input = [];
|
||||
private $open = true;
|
||||
|
||||
/**
|
||||
@@ -35,15 +38,16 @@ class InputStream implements \IteratorAggregate
|
||||
/**
|
||||
* Appends an input to the write buffer.
|
||||
*
|
||||
* @param resource|scalar|\Traversable|null The input to append as stream resource, scalar or \Traversable
|
||||
* @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar,
|
||||
* stream resource or \Traversable
|
||||
*/
|
||||
public function write($input)
|
||||
public function write(mixed $input)
|
||||
{
|
||||
if (null === $input) {
|
||||
return;
|
||||
}
|
||||
if ($this->isClosed()) {
|
||||
throw new RuntimeException(sprintf('%s is closed', static::class));
|
||||
throw new RuntimeException(sprintf('"%s" is closed.', static::class));
|
||||
}
|
||||
$this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
|
||||
}
|
||||
@@ -64,7 +68,7 @@ class InputStream implements \IteratorAggregate
|
||||
return !$this->open;
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
$this->open = true;
|
||||
|
||||
@@ -76,9 +80,7 @@ class InputStream implements \IteratorAggregate
|
||||
$current = array_shift($this->input);
|
||||
|
||||
if ($current instanceof \Iterator) {
|
||||
foreach ($current as $cur) {
|
||||
yield $cur;
|
||||
}
|
||||
yield from $current;
|
||||
} else {
|
||||
yield $current;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user