updated packages
This commit is contained in:
67
vendor/symfony/console/Application.php
vendored
67
vendor/symfony/console/Application.php
vendored
@@ -62,7 +62,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
*/
|
||||
class Application
|
||||
{
|
||||
private $commands = array();
|
||||
private $commands = [];
|
||||
private $wantHelps = false;
|
||||
private $runningCommand;
|
||||
private $name;
|
||||
@@ -193,17 +193,24 @@ class Application
|
||||
*/
|
||||
public function doRun(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (true === $input->hasParameterOption(array('--version', '-V'), true)) {
|
||||
if (true === $input->hasParameterOption(['--version', '-V'], true)) {
|
||||
$output->writeln($this->getLongVersion());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
// Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument.
|
||||
$input->bind($this->getDefinition());
|
||||
} catch (ExceptionInterface $e) {
|
||||
// Errors must be ignored, full binding/validation happens later when the command is known.
|
||||
}
|
||||
|
||||
$name = $this->getCommandName($input);
|
||||
if (true === $input->hasParameterOption(array('--help', '-h'), true)) {
|
||||
if (true === $input->hasParameterOption(['--help', '-h'], true)) {
|
||||
if (!$name) {
|
||||
$name = 'help';
|
||||
$input = new ArrayInput(array('command_name' => $this->defaultCommand));
|
||||
$input = new ArrayInput(['command_name' => $this->defaultCommand]);
|
||||
} else {
|
||||
$this->wantHelps = true;
|
||||
}
|
||||
@@ -214,9 +221,9 @@ class Application
|
||||
$definition = $this->getDefinition();
|
||||
$definition->setArguments(array_merge(
|
||||
$definition->getArguments(),
|
||||
array(
|
||||
[
|
||||
'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
|
||||
)
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
@@ -535,7 +542,7 @@ class Application
|
||||
*/
|
||||
public function getNamespaces()
|
||||
{
|
||||
$namespaces = array();
|
||||
$namespaces = [];
|
||||
foreach ($this->all() as $command) {
|
||||
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
|
||||
|
||||
@@ -602,7 +609,7 @@ class Application
|
||||
{
|
||||
$this->init();
|
||||
|
||||
$aliases = array();
|
||||
$aliases = [];
|
||||
$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
|
||||
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
|
||||
$commands = preg_grep('{^'.$expr.'}', $allCommands);
|
||||
@@ -695,7 +702,7 @@ class Application
|
||||
return $commands;
|
||||
}
|
||||
|
||||
$commands = array();
|
||||
$commands = [];
|
||||
foreach ($this->commands as $name => $command) {
|
||||
if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
|
||||
$commands[$name] = $command;
|
||||
@@ -722,7 +729,7 @@ class Application
|
||||
*/
|
||||
public static function getAbbreviations($names)
|
||||
{
|
||||
$abbrevs = array();
|
||||
$abbrevs = [];
|
||||
foreach ($names as $name) {
|
||||
for ($len = \strlen($name); $len > 0; --$len) {
|
||||
$abbrev = substr($name, 0, $len);
|
||||
@@ -768,18 +775,18 @@ class Application
|
||||
}
|
||||
|
||||
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
|
||||
$lines = array();
|
||||
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : array() as $line) {
|
||||
$lines = [];
|
||||
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
|
||||
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
|
||||
// pre-format lines to get the right string length
|
||||
$lineLength = Helper::strlen($line) + 4;
|
||||
$lines[] = array($line, $lineLength);
|
||||
$lines[] = [$line, $lineLength];
|
||||
|
||||
$len = max($lineLength, $len);
|
||||
}
|
||||
}
|
||||
|
||||
$messages = array();
|
||||
$messages = [];
|
||||
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
|
||||
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
|
||||
}
|
||||
@@ -801,12 +808,12 @@ class Application
|
||||
// exception related properties
|
||||
$trace = $e->getTrace();
|
||||
|
||||
array_unshift($trace, array(
|
||||
array_unshift($trace, [
|
||||
'function' => '',
|
||||
'file' => $e->getFile() ?: 'n/a',
|
||||
'line' => $e->getLine() ?: 'n/a',
|
||||
'args' => array(),
|
||||
));
|
||||
'args' => [],
|
||||
]);
|
||||
|
||||
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
|
||||
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
|
||||
@@ -828,13 +835,13 @@ class Application
|
||||
*/
|
||||
protected function configureIO(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (true === $input->hasParameterOption(array('--ansi'), true)) {
|
||||
if (true === $input->hasParameterOption(['--ansi'], true)) {
|
||||
$output->setDecorated(true);
|
||||
} elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) {
|
||||
} elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
|
||||
$output->setDecorated(false);
|
||||
}
|
||||
|
||||
if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) {
|
||||
if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
|
||||
$input->setInteractive(false);
|
||||
} elseif (\function_exists('posix_isatty')) {
|
||||
$inputStream = null;
|
||||
@@ -856,7 +863,7 @@ class Application
|
||||
default: $shellVerbosity = 0; break;
|
||||
}
|
||||
|
||||
if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) {
|
||||
if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
$shellVerbosity = -1;
|
||||
} else {
|
||||
@@ -957,7 +964,7 @@ class Application
|
||||
*/
|
||||
protected function getDefaultInputDefinition()
|
||||
{
|
||||
return new InputDefinition(array(
|
||||
return new InputDefinition([
|
||||
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
|
||||
|
||||
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
|
||||
@@ -967,7 +974,7 @@ class Application
|
||||
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
|
||||
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
|
||||
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -977,7 +984,7 @@ class Application
|
||||
*/
|
||||
protected function getDefaultCommands()
|
||||
{
|
||||
return array(new HelpCommand(), new ListCommand());
|
||||
return [new HelpCommand(), new ListCommand()];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -987,12 +994,12 @@ class Application
|
||||
*/
|
||||
protected function getDefaultHelperSet()
|
||||
{
|
||||
return new HelperSet(array(
|
||||
return new HelperSet([
|
||||
new FormatterHelper(),
|
||||
new DebugFormatterHelper(),
|
||||
new ProcessHelper(),
|
||||
new QuestionHelper(),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1037,9 +1044,9 @@ class Application
|
||||
private function findAlternatives($name, $collection)
|
||||
{
|
||||
$threshold = 1e3;
|
||||
$alternatives = array();
|
||||
$alternatives = [];
|
||||
|
||||
$collectionParts = array();
|
||||
$collectionParts = [];
|
||||
foreach ($collection as $item) {
|
||||
$collectionParts[$item] = explode(':', $item);
|
||||
}
|
||||
@@ -1116,7 +1123,7 @@ class Application
|
||||
}
|
||||
|
||||
$utf8String = mb_convert_encoding($string, 'utf8', $encoding);
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
$line = '';
|
||||
foreach (preg_split('//u', $utf8String) as $char) {
|
||||
// test if $char could be appended to current line
|
||||
@@ -1147,7 +1154,7 @@ class Application
|
||||
{
|
||||
// -1 as third argument is needed to skip the command short name when exploding
|
||||
$parts = explode(':', $name, -1);
|
||||
$namespaces = array();
|
||||
$namespaces = [];
|
||||
|
||||
foreach ($parts as $part) {
|
||||
if (\count($namespaces)) {
|
||||
|
||||
Reference in New Issue
Block a user