Laravel version update
Laravel version update
This commit is contained in:
13
vendor/symfony/console/Style/OutputStyle.php
vendored
13
vendor/symfony/console/Style/OutputStyle.php
vendored
@@ -13,6 +13,7 @@ namespace Symfony\Component\Console\Style;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
@@ -24,9 +25,6 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
||||
{
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
public function __construct(OutputInterface $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
@@ -145,4 +143,13 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
||||
{
|
||||
return $this->output->isDebug();
|
||||
}
|
||||
|
||||
protected function getErrorOutput()
|
||||
{
|
||||
if (!$this->output instanceof ConsoleOutputInterface) {
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
return $this->output->getErrorOutput();
|
||||
}
|
||||
}
|
||||
|
11
vendor/symfony/console/Style/StyleInterface.php
vendored
11
vendor/symfony/console/Style/StyleInterface.php
vendored
@@ -34,8 +34,6 @@ interface StyleInterface
|
||||
|
||||
/**
|
||||
* Formats a list.
|
||||
*
|
||||
* @param array $elements
|
||||
*/
|
||||
public function listing(array $elements);
|
||||
|
||||
@@ -83,9 +81,6 @@ interface StyleInterface
|
||||
|
||||
/**
|
||||
* Formats a table.
|
||||
*
|
||||
* @param array $headers
|
||||
* @param array $rows
|
||||
*/
|
||||
public function table(array $headers, array $rows);
|
||||
|
||||
@@ -96,7 +91,7 @@ interface StyleInterface
|
||||
* @param string|null $default
|
||||
* @param callable|null $validator
|
||||
*
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function ask($question, $default = null, $validator = null);
|
||||
|
||||
@@ -106,7 +101,7 @@ interface StyleInterface
|
||||
* @param string $question
|
||||
* @param callable|null $validator
|
||||
*
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function askHidden($question, $validator = null);
|
||||
|
||||
@@ -127,7 +122,7 @@ interface StyleInterface
|
||||
* @param array $choices
|
||||
* @param string|int|null $default
|
||||
*
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function choice($question, array $choices, $default = null);
|
||||
|
||||
|
56
vendor/symfony/console/Style/SymfonyStyle.php
vendored
56
vendor/symfony/console/Style/SymfonyStyle.php
vendored
@@ -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.
|
||||
@@ -40,16 +40,13 @@ class SymfonyStyle extends OutputStyle
|
||||
private $lineLength;
|
||||
private $bufferedOutput;
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
public function __construct(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
@@ -62,13 +59,14 @@ class SymfonyStyle extends OutputStyle
|
||||
* @param string|null $style The style to apply to the whole block
|
||||
* @param string $prefix The prefix for the block
|
||||
* @param bool $padding Whether to add vertical padding
|
||||
* @param bool $escape Whether to escape the message
|
||||
*/
|
||||
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
|
||||
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) : array($messages);
|
||||
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
|
||||
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
@@ -79,7 +77,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
|
||||
));
|
||||
$this->newLine();
|
||||
@@ -92,7 +90,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln(array(
|
||||
sprintf('<comment>%s</>', $message),
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
|
||||
));
|
||||
$this->newLine();
|
||||
@@ -119,7 +117,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$this->autoPrependText();
|
||||
|
||||
$messages = is_array($message) ? array_values($message) : array($message);
|
||||
$messages = \is_array($message) ? array_values($message) : array($message);
|
||||
foreach ($messages as $message) {
|
||||
$this->writeln(sprintf(' %s', $message));
|
||||
}
|
||||
@@ -132,11 +130,7 @@ class SymfonyStyle extends OutputStyle
|
||||
*/
|
||||
public function comment($message)
|
||||
{
|
||||
$messages = is_array($message) ? array_values($message) : array($message);
|
||||
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
|
||||
$this->newLine();
|
||||
$this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +269,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$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
|
||||
@@ -285,9 +279,7 @@ class SymfonyStyle extends OutputStyle
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Question $question
|
||||
*
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function askQuestion(Question $question)
|
||||
{
|
||||
@@ -336,6 +328,16 @@ class SymfonyStyle extends OutputStyle
|
||||
$this->bufferedOutput->write(str_repeat("\n", $count));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance which makes use of stderr if available.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function getErrorStyle()
|
||||
{
|
||||
return new self($this->input, $this->getErrorOutput());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProgressBar
|
||||
*/
|
||||
@@ -348,14 +350,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);
|
||||
@@ -393,7 +387,7 @@ class SymfonyStyle extends OutputStyle
|
||||
|
||||
if (null !== $type) {
|
||||
$type = sprintf('[%s] ', $type);
|
||||
$indentLength = strlen($type);
|
||||
$indentLength = \strlen($type);
|
||||
$lineIndentation = str_repeat(' ', $indentLength);
|
||||
}
|
||||
|
||||
@@ -405,7 +399,7 @@ class SymfonyStyle extends OutputStyle
|
||||
|
||||
$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[] = '';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user