Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/console/Style/SymfonyStyle.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
line wrap: on
line diff
--- a/vendor/symfony/console/Style/SymfonyStyle.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/console/Style/SymfonyStyle.php Thu Feb 28 13:21:36 2019 +0000 @@ -46,7 +46,7 @@ $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. $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH; - $this->lineLength = min($width - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); + $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); parent::__construct($output); } @@ -63,7 +63,7 @@ */ public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true) { - $messages = is_array($messages) ? array_values($messages) : array($messages); + $messages = \is_array($messages) ? array_values($messages) : [$messages]; $this->autoPrependBlock(); $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); @@ -76,10 +76,10 @@ public function title($message) { $this->autoPrependBlock(); - $this->writeln(array( + $this->writeln([ sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))), - )); + ]); $this->newLine(); } @@ -89,10 +89,10 @@ public function section($message) { $this->autoPrependBlock(); - $this->writeln(array( + $this->writeln([ sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))), - )); + ]); $this->newLine(); } @@ -117,7 +117,7 @@ { $this->autoPrependText(); - $messages = is_array($message) ? array_values($message) : array($message); + $messages = \is_array($message) ? array_values($message) : [$message]; foreach ($messages as $message) { $this->writeln(sprintf(' %s', $message)); } @@ -269,7 +269,7 @@ { $progressBar = parent::createProgressBar($max); - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) { $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591 $progressBar->setProgressCharacter(''); $progressBar->setBarCharacter('▓'); // dark shade character \u2593 @@ -376,18 +376,18 @@ // 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(array($this->bufferedOutput->fetch()), (array) $messages)); + }, array_merge([$this->bufferedOutput->fetch()], (array) $messages)); } private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false) { $indentLength = 0; $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix); - $lines = array(); + $lines = []; if (null !== $type) { $type = sprintf('[%s] ', $type); - $indentLength = strlen($type); + $indentLength = \strlen($type); $lineIndentation = str_repeat(' ', $indentLength); } @@ -399,7 +399,7 @@ $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true))); - if (count($messages) > 1 && $key < count($messages) - 1) { + if (\count($messages) > 1 && $key < \count($messages) - 1) { $lines[] = ''; } }