Skip to content

Commit a05148b

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents 8ac40ce + e326021 commit a05148b

File tree

98 files changed

+1375
-1375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1375
-1375
lines changed

Application.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
*/
6363
class Application
6464
{
65-
private $commands = array();
65+
private $commands = [];
6666
private $wantHelps = false;
6767
private $runningCommand;
6868
private $name;
@@ -193,17 +193,17 @@ public function run(InputInterface $input = null, OutputInterface $output = null
193193
*/
194194
public function doRun(InputInterface $input, OutputInterface $output)
195195
{
196-
if (true === $input->hasParameterOption(array('--version', '-V'), true)) {
196+
if (true === $input->hasParameterOption(['--version', '-V'], true)) {
197197
$output->writeln($this->getLongVersion());
198198

199199
return 0;
200200
}
201201

202202
$name = $this->getCommandName($input);
203-
if (true === $input->hasParameterOption(array('--help', '-h'), true)) {
203+
if (true === $input->hasParameterOption(['--help', '-h'], true)) {
204204
if (!$name) {
205205
$name = 'help';
206-
$input = new ArrayInput(array('command_name' => $this->defaultCommand));
206+
$input = new ArrayInput(['command_name' => $this->defaultCommand]);
207207
} else {
208208
$this->wantHelps = true;
209209
}
@@ -214,9 +214,9 @@ public function doRun(InputInterface $input, OutputInterface $output)
214214
$definition = $this->getDefinition();
215215
$definition->setArguments(array_merge(
216216
$definition->getArguments(),
217-
array(
217+
[
218218
'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
219-
)
219+
]
220220
));
221221
}
222222

@@ -535,7 +535,7 @@ public function has($name)
535535
*/
536536
public function getNamespaces()
537537
{
538-
$namespaces = array();
538+
$namespaces = [];
539539
foreach ($this->all() as $command) {
540540
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
541541

@@ -602,7 +602,7 @@ public function find($name)
602602
{
603603
$this->init();
604604

605-
$aliases = array();
605+
$aliases = [];
606606
$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
607607
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
608608
$commands = preg_grep('{^'.$expr.'}', $allCommands);
@@ -695,7 +695,7 @@ public function all($namespace = null)
695695
return $commands;
696696
}
697697

698-
$commands = array();
698+
$commands = [];
699699
foreach ($this->commands as $name => $command) {
700700
if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
701701
$commands[$name] = $command;
@@ -722,7 +722,7 @@ public function all($namespace = null)
722722
*/
723723
public static function getAbbreviations($names)
724724
{
725-
$abbrevs = array();
725+
$abbrevs = [];
726726
foreach ($names as $name) {
727727
for ($len = \strlen($name); $len > 0; --$len) {
728728
$abbrev = substr($name, 0, $len);
@@ -768,18 +768,18 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
768768
}
769769

770770
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
771-
$lines = array();
772-
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : array() as $line) {
771+
$lines = [];
772+
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
773773
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
774774
// pre-format lines to get the right string length
775775
$lineLength = Helper::strlen($line) + 4;
776-
$lines[] = array($line, $lineLength);
776+
$lines[] = [$line, $lineLength];
777777

778778
$len = max($lineLength, $len);
779779
}
780780
}
781781

782-
$messages = array();
782+
$messages = [];
783783
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
784784
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
785785
}
@@ -801,12 +801,12 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
801801
// exception related properties
802802
$trace = $e->getTrace();
803803

804-
array_unshift($trace, array(
804+
array_unshift($trace, [
805805
'function' => '',
806806
'file' => $e->getFile() ?: 'n/a',
807807
'line' => $e->getLine() ?: 'n/a',
808-
'args' => array(),
809-
));
808+
'args' => [],
809+
]);
810810

811811
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
812812
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
@@ -828,13 +828,13 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
828828
*/
829829
protected function configureIO(InputInterface $input, OutputInterface $output)
830830
{
831-
if (true === $input->hasParameterOption(array('--ansi'), true)) {
831+
if (true === $input->hasParameterOption(['--ansi'], true)) {
832832
$output->setDecorated(true);
833-
} elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) {
833+
} elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
834834
$output->setDecorated(false);
835835
}
836836

837-
if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) {
837+
if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
838838
$input->setInteractive(false);
839839
} elseif (\function_exists('posix_isatty')) {
840840
$inputStream = null;
@@ -856,7 +856,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
856856
default: $shellVerbosity = 0; break;
857857
}
858858

859-
if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) {
859+
if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
860860
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
861861
$shellVerbosity = -1;
862862
} else {
@@ -957,7 +957,7 @@ protected function getCommandName(InputInterface $input)
957957
*/
958958
protected function getDefaultInputDefinition()
959959
{
960-
return new InputDefinition(array(
960+
return new InputDefinition([
961961
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
962962

963963
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
@@ -967,7 +967,7 @@ protected function getDefaultInputDefinition()
967967
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
968968
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
969969
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
970-
));
970+
]);
971971
}
972972

973973
/**
@@ -977,7 +977,7 @@ protected function getDefaultInputDefinition()
977977
*/
978978
protected function getDefaultCommands()
979979
{
980-
return array(new HelpCommand(), new ListCommand());
980+
return [new HelpCommand(), new ListCommand()];
981981
}
982982

983983
/**
@@ -987,12 +987,12 @@ protected function getDefaultCommands()
987987
*/
988988
protected function getDefaultHelperSet()
989989
{
990-
return new HelperSet(array(
990+
return new HelperSet([
991991
new FormatterHelper(),
992992
new DebugFormatterHelper(),
993993
new ProcessHelper(),
994994
new QuestionHelper(),
995-
));
995+
]);
996996
}
997997

998998
/**
@@ -1037,9 +1037,9 @@ public function extractNamespace($name, $limit = null)
10371037
private function findAlternatives($name, $collection)
10381038
{
10391039
$threshold = 1e3;
1040-
$alternatives = array();
1040+
$alternatives = [];
10411041

1042-
$collectionParts = array();
1042+
$collectionParts = [];
10431043
foreach ($collection as $item) {
10441044
$collectionParts[$item] = explode(':', $item);
10451045
}
@@ -1116,7 +1116,7 @@ private function splitStringByWidth($string, $width)
11161116
}
11171117

11181118
$utf8String = mb_convert_encoding($string, 'utf8', $encoding);
1119-
$lines = array();
1119+
$lines = [];
11201120
$line = '';
11211121
foreach (preg_split('//u', $utf8String) as $char) {
11221122
// test if $char could be appended to current line
@@ -1147,7 +1147,7 @@ private function extractAllNamespaces($name)
11471147
{
11481148
// -1 as third argument is needed to skip the command short name when exploding
11491149
$parts = explode(':', $name, -1);
1150-
$namespaces = array();
1150+
$namespaces = [];
11511151

11521152
foreach ($parts as $part) {
11531153
if (\count($namespaces)) {

Command/Command.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Command
3737
private $application;
3838
private $name;
3939
private $processTitle;
40-
private $aliases = array();
40+
private $aliases = [];
4141
private $definition;
4242
private $hidden = false;
4343
private $help;
@@ -46,8 +46,8 @@ class Command
4646
private $applicationDefinitionMerged = false;
4747
private $applicationDefinitionMergedWithArgs = false;
4848
private $code;
49-
private $synopsis = array();
50-
private $usages = array();
49+
private $synopsis = [];
50+
private $usages = [];
5151
private $helperSet;
5252

5353
/**
@@ -527,14 +527,14 @@ public function getProcessedHelp()
527527
$name = $this->name;
528528
$isSingleCommand = $this->application && $this->application->isSingleCommand();
529529

530-
$placeholders = array(
530+
$placeholders = [
531531
'%command.name%',
532532
'%command.full_name%',
533-
);
534-
$replacements = array(
533+
];
534+
$replacements = [
535535
$name,
536536
$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
537-
);
537+
];
538538

539539
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
540540
}

Command/HelpCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ protected function configure()
3535

3636
$this
3737
->setName('help')
38-
->setDefinition(array(
38+
->setDefinition([
3939
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
4040
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
4141
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
42-
))
42+
])
4343
->setDescription('Displays help for a command')
4444
->setHelp(<<<'EOF'
4545
The <info>%command.name%</info> command displays help for a given command:
@@ -71,10 +71,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
7171
}
7272

7373
$helper = new DescriptorHelper();
74-
$helper->describe($output, $this->command, array(
74+
$helper->describe($output, $this->command, [
7575
'format' => $input->getOption('format'),
7676
'raw_text' => $input->getOption('raw'),
77-
));
77+
]);
7878

7979
$this->command = null;
8080
}

Command/ListCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,22 @@ public function getNativeDefinition()
6969
protected function execute(InputInterface $input, OutputInterface $output)
7070
{
7171
$helper = new DescriptorHelper();
72-
$helper->describe($output, $this->getApplication(), array(
72+
$helper->describe($output, $this->getApplication(), [
7373
'format' => $input->getOption('format'),
7474
'raw_text' => $input->getOption('raw'),
7575
'namespace' => $input->getArgument('namespace'),
76-
));
76+
]);
7777
}
7878

7979
/**
8080
* {@inheritdoc}
8181
*/
8282
private function createDefinition()
8383
{
84-
return new InputDefinition(array(
84+
return new InputDefinition([
8585
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
8686
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
8787
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
88-
));
88+
]);
8989
}
9090
}

DependencyInjection/AddConsoleCommandPass.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function __construct(string $commandLoaderServiceId = 'console.command_lo
3838
public function process(ContainerBuilder $container)
3939
{
4040
$commandServices = $container->findTaggedServiceIds($this->commandTag, true);
41-
$lazyCommandMap = array();
42-
$lazyCommandRefs = array();
43-
$serviceIds = array();
41+
$lazyCommandMap = [];
42+
$lazyCommandRefs = [];
43+
$serviceIds = [];
4444

4545
foreach ($commandServices as $id => $tags) {
4646
$definition = $container->getDefinition($id);
@@ -72,7 +72,7 @@ public function process(ContainerBuilder $container)
7272
unset($tags[0]);
7373
$lazyCommandMap[$commandName] = $id;
7474
$lazyCommandRefs[$id] = new TypedReference($id, $class);
75-
$aliases = array();
75+
$aliases = [];
7676

7777
foreach ($tags as $tag) {
7878
if (isset($tag['command'])) {
@@ -81,17 +81,17 @@ public function process(ContainerBuilder $container)
8181
}
8282
}
8383

84-
$definition->addMethodCall('setName', array($commandName));
84+
$definition->addMethodCall('setName', [$commandName]);
8585

8686
if ($aliases) {
87-
$definition->addMethodCall('setAliases', array($aliases));
87+
$definition->addMethodCall('setAliases', [$aliases]);
8888
}
8989
}
9090

9191
$container
9292
->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
9393
->setPublic(true)
94-
->setArguments(array(ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap));
94+
->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
9595

9696
$container->setParameter('console.command.ids', $serviceIds);
9797
}

Descriptor/ApplicationDescription.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ public function getCommand($name)
9292

9393
private function inspectApplication()
9494
{
95-
$this->commands = array();
96-
$this->namespaces = array();
95+
$this->commands = [];
96+
$this->namespaces = [];
9797

9898
$all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
9999
foreach ($this->sortCommands($all) as $namespace => $commands) {
100-
$names = array();
100+
$names = [];
101101

102102
/** @var Command $command */
103103
foreach ($commands as $name => $command) {
@@ -114,14 +114,14 @@ private function inspectApplication()
114114
$names[] = $name;
115115
}
116116

117-
$this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
117+
$this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
118118
}
119119
}
120120

121121
private function sortCommands(array $commands): array
122122
{
123-
$namespacedCommands = array();
124-
$globalCommands = array();
123+
$namespacedCommands = [];
124+
$globalCommands = [];
125125
foreach ($commands as $name => $command) {
126126
$key = $this->application->extractNamespace($name, 1);
127127
if (!$key) {

0 commit comments

Comments
 (0)