Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db33c3e

Browse files
committed
fixed CS
1 parent 68001d4 commit db33c3e

25 files changed

+709
-709
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);
@@ -760,18 +760,18 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
760760
}
761761

762762
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
763-
$lines = array();
764-
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : array() as $line) {
763+
$lines = [];
764+
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
765765
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
766766
// pre-format lines to get the right string length
767767
$lineLength = Helper::strlen($line) + 4;
768-
$lines[] = array($line, $lineLength);
768+
$lines[] = [$line, $lineLength];
769769

770770
$len = max($lineLength, $len);
771771
}
772772
}
773773

774-
$messages = array();
774+
$messages = [];
775775
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
776776
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
777777
}
@@ -793,12 +793,12 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
793793
// exception related properties
794794
$trace = $e->getTrace();
795795

796-
array_unshift($trace, array(
796+
array_unshift($trace, [
797797
'function' => '',
798798
'file' => $e->getFile() ?: 'n/a',
799799
'line' => $e->getLine() ?: 'n/a',
800-
'args' => array(),
801-
));
800+
'args' => [],
801+
]);
802802

803803
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
804804
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
@@ -820,13 +820,13 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
820820
*/
821821
protected function configureIO(InputInterface $input, OutputInterface $output)
822822
{
823-
if (true === $input->hasParameterOption(array('--ansi'), true)) {
823+
if (true === $input->hasParameterOption(['--ansi'], true)) {
824824
$output->setDecorated(true);
825-
} elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) {
825+
} elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
826826
$output->setDecorated(false);
827827
}
828828

829-
if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) {
829+
if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
830830
$input->setInteractive(false);
831831
} elseif (\function_exists('posix_isatty')) {
832832
$inputStream = null;
@@ -848,7 +848,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
848848
default: $shellVerbosity = 0; break;
849849
}
850850

851-
if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) {
851+
if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
852852
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
853853
$shellVerbosity = -1;
854854
} else {
@@ -949,7 +949,7 @@ protected function getCommandName(InputInterface $input)
949949
*/
950950
protected function getDefaultInputDefinition()
951951
{
952-
return new InputDefinition(array(
952+
return new InputDefinition([
953953
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
954954

955955
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
@@ -959,7 +959,7 @@ protected function getDefaultInputDefinition()
959959
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
960960
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
961961
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
962-
));
962+
]);
963963
}
964964

965965
/**
@@ -969,7 +969,7 @@ protected function getDefaultInputDefinition()
969969
*/
970970
protected function getDefaultCommands()
971971
{
972-
return array(new HelpCommand(), new ListCommand());
972+
return [new HelpCommand(), new ListCommand()];
973973
}
974974

975975
/**
@@ -979,12 +979,12 @@ protected function getDefaultCommands()
979979
*/
980980
protected function getDefaultHelperSet()
981981
{
982-
return new HelperSet(array(
982+
return new HelperSet([
983983
new FormatterHelper(),
984984
new DebugFormatterHelper(),
985985
new ProcessHelper(),
986986
new QuestionHelper(),
987-
));
987+
]);
988988
}
989989

990990
/**
@@ -1029,9 +1029,9 @@ public function extractNamespace($name, $limit = null)
10291029
private function findAlternatives($name, $collection)
10301030
{
10311031
$threshold = 1e3;
1032-
$alternatives = array();
1032+
$alternatives = [];
10331033

1034-
$collectionParts = array();
1034+
$collectionParts = [];
10351035
foreach ($collection as $item) {
10361036
$collectionParts[$item] = explode(':', $item);
10371037
}
@@ -1108,7 +1108,7 @@ private function splitStringByWidth($string, $width)
11081108
}
11091109

11101110
$utf8String = mb_convert_encoding($string, 'utf8', $encoding);
1111-
$lines = array();
1111+
$lines = [];
11121112
$line = '';
11131113
foreach (preg_split('//u', $utf8String) as $char) {
11141114
// test if $char could be appended to current line
@@ -1139,7 +1139,7 @@ private function extractAllNamespaces($name)
11391139
{
11401140
// -1 as third argument is needed to skip the command short name when exploding
11411141
$parts = explode(':', $name, -1);
1142-
$namespaces = array();
1142+
$namespaces = [];
11431143

11441144
foreach ($parts as $part) {
11451145
if (\count($namespaces)) {

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
}

Exception/CommandNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
2626
* @param int $code Exception code
2727
* @param \Exception $previous Previous exception used for the exception chaining
2828
*/
29-
public function __construct(string $message, array $alternatives = array(), int $code = 0, \Exception $previous = null)
29+
public function __construct(string $message, array $alternatives = [], int $code = 0, \Exception $previous = null)
3030
{
3131
parent::__construct($message, $code, $previous);
3232

Formatter/OutputFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class OutputFormatter implements OutputFormatterInterface
2222
{
2323
private $decorated;
24-
private $styles = array();
24+
private $styles = [];
2525
private $styleStack;
2626

2727
/**
@@ -65,7 +65,7 @@ public static function escapeTrailingBackslash($text)
6565
* @param bool $decorated Whether this formatter should actually decorate strings
6666
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
6767
*/
68-
public function __construct(bool $decorated = false, array $styles = array())
68+
public function __construct(bool $decorated = false, array $styles = [])
6969
{
7070
$this->decorated = $decorated;
7171

@@ -169,7 +169,7 @@ public function format($message)
169169
$output .= $this->applyCurrentStyle(substr($message, $offset));
170170

171171
if (false !== strpos($output, "\0")) {
172-
return strtr($output, array("\0" => '\\', '\\<' => '<'));
172+
return strtr($output, ["\0" => '\\', '\\<' => '<']);
173173
}
174174

175175
return str_replace('\\<', '<', $output);

Formatter/OutputFormatterStyle.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,39 @@
2020
*/
2121
class OutputFormatterStyle implements OutputFormatterStyleInterface
2222
{
23-
private static $availableForegroundColors = array(
24-
'black' => array('set' => 30, 'unset' => 39),
25-
'red' => array('set' => 31, 'unset' => 39),
26-
'green' => array('set' => 32, 'unset' => 39),
27-
'yellow' => array('set' => 33, 'unset' => 39),
28-
'blue' => array('set' => 34, 'unset' => 39),
29-
'magenta' => array('set' => 35, 'unset' => 39),
30-
'cyan' => array('set' => 36, 'unset' => 39),
31-
'white' => array('set' => 37, 'unset' => 39),
32-
'default' => array('set' => 39, 'unset' => 39),
33-
);
34-
private static $availableBackgroundColors = array(
35-
'black' => array('set' => 40, 'unset' => 49),
36-
'red' => array('set' => 41, 'unset' => 49),
37-
'green' => array('set' => 42, 'unset' => 49),
38-
'yellow' => array('set' => 43, 'unset' => 49),
39-
'blue' => array('set' => 44, 'unset' => 49),
40-
'magenta' => array('set' => 45, 'unset' => 49),
41-
'cyan' => array('set' => 46, 'unset' => 49),
42-
'white' => array('set' => 47, 'unset' => 49),
43-
'default' => array('set' => 49, 'unset' => 49),
44-
);
45-
private static $availableOptions = array(
46-
'bold' => array('set' => 1, 'unset' => 22),
47-
'underscore' => array('set' => 4, 'unset' => 24),
48-
'blink' => array('set' => 5, 'unset' => 25),
49-
'reverse' => array('set' => 7, 'unset' => 27),
50-
'conceal' => array('set' => 8, 'unset' => 28),
51-
);
23+
private static $availableForegroundColors = [
24+
'black' => ['set' => 30, 'unset' => 39],
25+
'red' => ['set' => 31, 'unset' => 39],
26+
'green' => ['set' => 32, 'unset' => 39],
27+
'yellow' => ['set' => 33, 'unset' => 39],
28+
'blue' => ['set' => 34, 'unset' => 39],
29+
'magenta' => ['set' => 35, 'unset' => 39],
30+
'cyan' => ['set' => 36, 'unset' => 39],
31+
'white' => ['set' => 37, 'unset' => 39],
32+
'default' => ['set' => 39, 'unset' => 39],
33+
];
34+
private static $availableBackgroundColors = [
35+
'black' => ['set' => 40, 'unset' => 49],
36+
'red' => ['set' => 41, 'unset' => 49],
37+
'green' => ['set' => 42, 'unset' => 49],
38+
'yellow' => ['set' => 43, 'unset' => 49],
39+
'blue' => ['set' => 44, 'unset' => 49],
40+
'magenta' => ['set' => 45, 'unset' => 49],
41+
'cyan' => ['set' => 46, 'unset' => 49],
42+
'white' => ['set' => 47, 'unset' => 49],
43+
'default' => ['set' => 49, 'unset' => 49],
44+
];
45+
private static $availableOptions = [
46+
'bold' => ['set' => 1, 'unset' => 22],
47+
'underscore' => ['set' => 4, 'unset' => 24],
48+
'blink' => ['set' => 5, 'unset' => 25],
49+
'reverse' => ['set' => 7, 'unset' => 27],
50+
'conceal' => ['set' => 8, 'unset' => 28],
51+
];
5252

5353
private $foreground;
5454
private $background;
55-
private $options = array();
55+
private $options = [];
5656

5757
/**
5858
* Initializes output formatter style.
@@ -61,7 +61,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
6161
* @param string|null $background The style background color name
6262
* @param array $options The style options
6363
*/
64-
public function __construct(string $foreground = null, string $background = null, array $options = array())
64+
public function __construct(string $foreground = null, string $background = null, array $options = [])
6565
{
6666
if (null !== $foreground) {
6767
$this->setForeground($foreground);
@@ -160,7 +160,7 @@ public function unsetOption($option)
160160
*/
161161
public function setOptions(array $options)
162162
{
163-
$this->options = array();
163+
$this->options = [];
164164

165165
foreach ($options as $option) {
166166
$this->setOption($option);
@@ -176,8 +176,8 @@ public function setOptions(array $options)
176176
*/
177177
public function apply($text)
178178
{
179-
$setCodes = array();
180-
$unsetCodes = array();
179+
$setCodes = [];
180+
$unsetCodes = [];
181181

182182
if (null !== $this->foreground) {
183183
$setCodes[] = $this->foreground['set'];

0 commit comments

Comments
 (0)