updated packages
This commit is contained in:
@@ -92,12 +92,12 @@ class ApplicationDescription
|
||||
|
||||
private function inspectApplication()
|
||||
{
|
||||
$this->commands = array();
|
||||
$this->namespaces = array();
|
||||
$this->commands = [];
|
||||
$this->namespaces = [];
|
||||
|
||||
$all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
|
||||
foreach ($this->sortCommands($all) as $namespace => $commands) {
|
||||
$names = array();
|
||||
$names = [];
|
||||
|
||||
/** @var Command $command */
|
||||
foreach ($commands as $name => $command) {
|
||||
@@ -114,14 +114,14 @@ class ApplicationDescription
|
||||
$names[] = $name;
|
||||
}
|
||||
|
||||
$this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
|
||||
$this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
|
||||
}
|
||||
}
|
||||
|
||||
private function sortCommands(array $commands): array
|
||||
{
|
||||
$namespacedCommands = array();
|
||||
$globalCommands = array();
|
||||
$namespacedCommands = [];
|
||||
$globalCommands = [];
|
||||
foreach ($commands as $name => $command) {
|
||||
$key = $this->application->extractNamespace($name, 1);
|
||||
if (!$key) {
|
||||
|
||||
12
vendor/symfony/console/Descriptor/Descriptor.php
vendored
12
vendor/symfony/console/Descriptor/Descriptor.php
vendored
@@ -34,7 +34,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, array $options = array())
|
||||
public function describe(OutputInterface $output, $object, array $options = [])
|
||||
{
|
||||
$this->output = $output;
|
||||
|
||||
@@ -75,33 +75,33 @@ abstract class Descriptor implements DescriptorInterface
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
|
||||
abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an InputOption instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputOption(InputOption $option, array $options = array());
|
||||
abstract protected function describeInputOption(InputOption $option, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an InputDefinition instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
|
||||
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes a Command instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeCommand(Command $command, array $options = array());
|
||||
abstract protected function describeCommand(Command $command, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an Application instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeApplication(Application $application, array $options = array());
|
||||
abstract protected function describeApplication(Application $application, array $options = []);
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ interface DescriptorInterface
|
||||
* @param object $object
|
||||
* @param array $options
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, array $options = array());
|
||||
public function describe(OutputInterface $output, $object, array $options = []);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = array())
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
{
|
||||
$this->writeData($this->getInputArgumentData($argument), $options);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputOption(InputOption $option, array $options = array())
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
$this->writeData($this->getInputOptionData($option), $options);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
{
|
||||
$this->writeData($this->getInputDefinitionData($definition), $options);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = array())
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$this->writeData($this->getCommandData($command), $options);
|
||||
}
|
||||
@@ -61,17 +61,17 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace, true);
|
||||
$commands = array();
|
||||
$commands = [];
|
||||
|
||||
foreach ($description->getCommands() as $command) {
|
||||
$commands[] = $this->getCommandData($command);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
if ('UNKNOWN' !== $application->getName()) {
|
||||
$data['application']['name'] = $application->getName();
|
||||
if ('UNKNOWN' !== $application->getVersion()) {
|
||||
@@ -105,13 +105,13 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
private function getInputArgumentData(InputArgument $argument)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'name' => $argument->getName(),
|
||||
'is_required' => $argument->isRequired(),
|
||||
'is_array' => $argument->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
|
||||
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
private function getInputOptionData(InputOption $option)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'name' => '--'.$option->getName(),
|
||||
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
|
||||
'accept_value' => $option->acceptValue(),
|
||||
@@ -127,7 +127,7 @@ class JsonDescriptor extends Descriptor
|
||||
'is_multiple' => $option->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
|
||||
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,17 +135,17 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
private function getInputDefinitionData(InputDefinition $definition)
|
||||
{
|
||||
$inputArguments = array();
|
||||
$inputArguments = [];
|
||||
foreach ($definition->getArguments() as $name => $argument) {
|
||||
$inputArguments[$name] = $this->getInputArgumentData($argument);
|
||||
}
|
||||
|
||||
$inputOptions = array();
|
||||
$inputOptions = [];
|
||||
foreach ($definition->getOptions() as $name => $option) {
|
||||
$inputOptions[$name] = $this->getInputOptionData($option);
|
||||
}
|
||||
|
||||
return array('arguments' => $inputArguments, 'options' => $inputOptions);
|
||||
return ['arguments' => $inputArguments, 'options' => $inputOptions];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,13 +156,13 @@ class JsonDescriptor extends Descriptor
|
||||
$command->getSynopsis();
|
||||
$command->mergeApplicationDefinition(false);
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name' => $command->getName(),
|
||||
'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
|
||||
'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
|
||||
'description' => $command->getDescription(),
|
||||
'help' => $command->getProcessedHelp(),
|
||||
'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
|
||||
'hidden' => $command->isHidden(),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, array $options = array())
|
||||
public function describe(OutputInterface $output, $object, array $options = [])
|
||||
{
|
||||
$decorated = $output->isDecorated();
|
||||
$output->setDecorated(false);
|
||||
@@ -52,7 +52,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = array())
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
{
|
||||
$this->write(
|
||||
'#### `'.($argument->getName() ?: '<none>')."`\n\n"
|
||||
@@ -66,7 +66,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputOption(InputOption $option, array $options = array())
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
$name = '--'.$option->getName();
|
||||
if ($option->getShortcut()) {
|
||||
@@ -86,7 +86,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
{
|
||||
if ($showArguments = \count($definition->getArguments()) > 0) {
|
||||
$this->write('### Arguments');
|
||||
@@ -112,7 +112,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = array())
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$command->getSynopsis();
|
||||
$command->mergeApplicationDefinition(false);
|
||||
@@ -122,7 +122,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
.str_repeat('-', Helper::strlen($command->getName()) + 2)."\n\n"
|
||||
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
|
||||
.'### Usage'."\n\n"
|
||||
.array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
|
||||
.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
|
||||
return $carry.'* `'.$usage.'`'."\n";
|
||||
})
|
||||
);
|
||||
@@ -141,7 +141,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
|
||||
@@ -31,7 +31,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = array())
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
{
|
||||
if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
|
||||
$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
|
||||
@@ -54,7 +54,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputOption(InputOption $option, array $options = array())
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
|
||||
$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
|
||||
@@ -71,7 +71,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
|
||||
$totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
|
||||
$totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]);
|
||||
$synopsis = sprintf('%s%s',
|
||||
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
|
||||
sprintf('--%s%s', $option->getName(), $value)
|
||||
@@ -92,7 +92,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
{
|
||||
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
@@ -103,7 +103,7 @@ class TextDescriptor extends Descriptor
|
||||
$this->writeText('<comment>Arguments:</comment>', $options);
|
||||
$this->writeText("\n");
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
$this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
|
||||
$this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
|
||||
$this->writeText("\n");
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
if ($definition->getOptions()) {
|
||||
$laterOptions = array();
|
||||
$laterOptions = [];
|
||||
|
||||
$this->writeText('<comment>Options:</comment>', $options);
|
||||
foreach ($definition->getOptions() as $option) {
|
||||
@@ -122,11 +122,11 @@ class TextDescriptor extends Descriptor
|
||||
continue;
|
||||
}
|
||||
$this->writeText("\n");
|
||||
$this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
|
||||
$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
|
||||
}
|
||||
foreach ($laterOptions as $option) {
|
||||
$this->writeText("\n");
|
||||
$this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
|
||||
$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = array())
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$command->getSynopsis(true);
|
||||
$command->getSynopsis(false);
|
||||
@@ -148,7 +148,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
$this->writeText('<comment>Usage:</comment>', $options);
|
||||
foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
$this->writeText("\n");
|
||||
$this->writeText(' '.OutputFormatter::escape($usage), $options);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
@@ -250,7 +250,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
private function writeText($content, array $options = array())
|
||||
private function writeText($content, array $options = [])
|
||||
{
|
||||
$this->write(
|
||||
isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
|
||||
@@ -302,7 +302,7 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
private function getColumnWidth(array $commands): int
|
||||
{
|
||||
$widths = array();
|
||||
$widths = [];
|
||||
|
||||
foreach ($commands as $command) {
|
||||
if ($command instanceof Command) {
|
||||
|
||||
@@ -64,7 +64,7 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
$commandXML->appendChild($usagesXML = $dom->createElement('usages'));
|
||||
|
||||
foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
$usagesXML->appendChild($dom->createElement('usage', $usage));
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = array())
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputArgumentDocument($argument));
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputOption(InputOption $option, array $options = array())
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputOptionDocument($option));
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputDefinitionDocument($definition));
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = array())
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getCommandDocument($command));
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class XmlDescriptor extends Descriptor
|
||||
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
|
||||
|
||||
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
|
||||
$defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
|
||||
$defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
|
||||
foreach ($defaults as $default) {
|
||||
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
|
||||
$defaultXML->appendChild($dom->createTextNode($default));
|
||||
@@ -229,7 +229,7 @@ class XmlDescriptor extends Descriptor
|
||||
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
|
||||
|
||||
if ($option->acceptValue()) {
|
||||
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
|
||||
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
|
||||
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
|
||||
|
||||
if (!empty($defaults)) {
|
||||
|
||||
Reference in New Issue
Block a user