Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -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;
}