diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 4e0afeae78a0d..92f9ddcff3552 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -462,10 +462,6 @@ private function validateAttempts(callable $interviewer, OutputInterface $output $error = null; $attempts = $question->getMaxAttempts(); - if (null === $attempts && !$this->isTty()) { - $attempts = 1; - } - while (null === $attempts || $attempts--) { if (null !== $error) { $this->writeError($output, $error); @@ -477,6 +473,8 @@ private function validateAttempts(callable $interviewer, OutputInterface $output throw $e; } catch (\Exception $error) { } + + $attempts = $attempts ?? -(int) $this->isTty(); } throw $error; @@ -517,7 +515,7 @@ private function isTty(): bool return stream_isatty($inputStream); } - if (!\function_exists('posix_isatty')) { + if (\function_exists('posix_isatty')) { return posix_isatty($inputStream); }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: