Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
*/
public function newLine($count = 1)
{
$this->output->write(str_repeat(\PHP_EOL, $count));
$this->output->write(str_repeat(PHP_EOL, $count));
}
/**
+1
View File
@@ -119,6 +119,7 @@ interface StyleInterface
* Asks a choice question.
*
* @param string $question
* @param array $choices
* @param string|int|null $default
*
* @return mixed
+25 -18
View File
@@ -229,7 +229,7 @@ class SymfonyStyle extends OutputStyle
{
if (null !== $default) {
$values = array_flip($choices);
$default = isset($values[$default]) ? $values[$default] : $default;
$default = $values[$default];
}
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
@@ -306,8 +306,14 @@ class SymfonyStyle extends OutputStyle
*/
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
parent::writeln($messages, $type);
$this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
if (!is_iterable($messages)) {
$messages = [$messages];
}
foreach ($messages as $message) {
parent::writeln($message, $type);
$this->writeBuffer($message, true, $type);
}
}
/**
@@ -315,8 +321,14 @@ class SymfonyStyle extends OutputStyle
*/
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
parent::write($messages, $newline, $type);
$this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
if (!is_iterable($messages)) {
$messages = [$messages];
}
foreach ($messages as $message) {
parent::write($message, $newline, $type);
$this->writeBuffer($message, $newline, $type);
}
}
/**
@@ -338,10 +350,7 @@ class SymfonyStyle extends OutputStyle
return new self($this->input, $this->getErrorOutput());
}
/**
* @return ProgressBar
*/
private function getProgressBar()
private function getProgressBar(): ProgressBar
{
if (!$this->progressBar) {
throw new RuntimeException('The ProgressBar is not started.');
@@ -350,9 +359,9 @@ class SymfonyStyle extends OutputStyle
return $this->progressBar;
}
private function autoPrependBlock()
private function autoPrependBlock(): void
{
$chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
if (!isset($chars[0])) {
$this->newLine(); //empty history, so we should start with a new line.
@@ -363,7 +372,7 @@ class SymfonyStyle extends OutputStyle
$this->newLine(2 - substr_count($chars, "\n"));
}
private function autoPrependText()
private function autoPrependText(): void
{
$fetched = $this->bufferedOutput->fetch();
//Prepend new line if last char isn't EOL:
@@ -372,16 +381,14 @@ class SymfonyStyle extends OutputStyle
}
}
private function reduceBuffer($messages)
private function writeBuffer(string $message, bool $newLine, int $type): void
{
// We need to know if the two last chars are PHP_EOL
// Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
return array_map(function ($value) {
return substr($value, -4);
}, array_merge([$this->bufferedOutput->fetch()], (array) $messages));
$this->bufferedOutput->write(substr($message, -4), $newLine, $type);
}
private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false)
{
$indentLength = 0;
$prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
@@ -399,7 +406,7 @@ class SymfonyStyle extends OutputStyle
$message = OutputFormatter::escape($message);
}
$lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true)));
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
if (\count($messages) > 1 && $key < \count($messages) - 1) {
$lines[] = '';