Updates to vendors etc

This commit is contained in:
Chris Hunt
2025-07-11 15:57:48 +01:00
parent d972cbcd0a
commit 8fb6438254
8043 changed files with 248005 additions and 189479 deletions

View File

@@ -34,11 +34,6 @@ use function Symfony\Component\String\s;
*/
class QuestionHelper extends Helper
{
/**
* @var resource|null
*/
private $inputStream;
private static bool $stty = true;
private static bool $stdinIsInteractive;
@@ -59,16 +54,15 @@ class QuestionHelper extends Helper
return $this->getDefaultAnswer($question);
}
if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
$this->inputStream = $stream;
}
$inputStream = $input instanceof StreamableInputInterface ? $input->getStream() : null;
$inputStream ??= \STDIN;
try {
if (!$question->getValidator()) {
return $this->doAsk($output, $question);
return $this->doAsk($inputStream, $output, $question);
}
$interviewer = fn () => $this->doAsk($output, $question);
$interviewer = fn () => $this->doAsk($inputStream, $output, $question);
return $this->validateAttempts($interviewer, $output, $question);
} catch (MissingInputException $exception) {
@@ -89,10 +83,8 @@ class QuestionHelper extends Helper
/**
* Prevents usage of stty.
*
* @return void
*/
public static function disableStty()
public static function disableStty(): void
{
self::$stty = false;
}
@@ -100,13 +92,14 @@ class QuestionHelper extends Helper
/**
* Asks the question to the user.
*
* @param resource $inputStream
*
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
*/
private function doAsk(OutputInterface $output, Question $question): mixed
private function doAsk($inputStream, OutputInterface $output, Question $question): mixed
{
$this->writePrompt($output, $question);
$inputStream = $this->inputStream ?: \STDIN;
$autocomplete = $question->getAutocompleterCallback();
if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
@@ -190,10 +183,8 @@ class QuestionHelper extends Helper
/**
* Outputs the question prompt.
*
* @return void
*/
protected function writePrompt(OutputInterface $output, Question $question)
protected function writePrompt(OutputInterface $output, Question $question): void
{
$message = $question->getQuestion();
@@ -220,7 +211,7 @@ class QuestionHelper extends Helper
foreach ($choices as $key => $value) {
$padding = str_repeat(' ', $maxWidth - self::width($key));
$messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
$messages[] = \sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
}
return $messages;
@@ -228,10 +219,8 @@ class QuestionHelper extends Helper
/**
* Outputs an error message.
*
* @return void
*/
protected function writeError(OutputInterface $output, \Exception $error)
protected function writeError(OutputInterface $output, \Exception $error): void
{
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
@@ -501,19 +490,7 @@ class QuestionHelper extends Helper
return self::$stdinIsInteractive;
}
if (\function_exists('stream_isatty')) {
return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
}
if (\function_exists('posix_isatty')) {
return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
}
if (!\function_exists('shell_exec')) {
return self::$stdinIsInteractive = true;
}
return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
}
/**