Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / console / Style / SymfonyStyle.php
index 9ae6513ceb031270da14dea782785a08477194b6..3c9617fbd25f026dd2f8a188e1b0569124f66ee4 100644 (file)
@@ -11,7 +11,6 @@
 
 namespace Symfony\Component\Console\Style;
 
-use Symfony\Component\Console\Application;
 use Symfony\Component\Console\Exception\RuntimeException;
 use Symfony\Component\Console\Formatter\OutputFormatter;
 use Symfony\Component\Console\Helper\Helper;
@@ -24,6 +23,7 @@ use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\ChoiceQuestion;
 use Symfony\Component\Console\Question\ConfirmationQuestion;
 use Symfony\Component\Console\Question\Question;
+use Symfony\Component\Console\Terminal;
 
 /**
  * Output decorator helpers for the Symfony Style Guide.
@@ -49,7 +49,8 @@ class SymfonyStyle extends OutputStyle
         $this->input = $input;
         $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
         // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
-        $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
+        $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
+        $this->lineLength = min($width - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
 
         parent::__construct($output);
     }
@@ -348,14 +349,6 @@ class SymfonyStyle extends OutputStyle
         return $this->progressBar;
     }
 
-    private function getTerminalWidth()
-    {
-        $application = new Application();
-        $dimensions = $application->getTerminalDimensions();
-
-        return $dimensions[0] ?: self::MAX_LINE_LENGTH;
-    }
-
     private function autoPrependBlock()
     {
         $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);