Skip to content

Commit b36a29e

Browse files
committed
fixed CS
1 parent 29063f2 commit b36a29e

37 files changed

+778
-778
lines changed

Command/AboutCommand.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,44 +61,44 @@ protected function execute(InputInterface $input, OutputInterface $output)
6161
/** @var KernelInterface $kernel */
6262
$kernel = $this->getApplication()->getKernel();
6363

64-
$rows = array(
65-
array('<info>Symfony</>'),
64+
$rows = [
65+
['<info>Symfony</>'],
6666
new TableSeparator(),
67-
array('Version', Kernel::VERSION),
68-
array('End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')),
69-
array('End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')),
67+
['Version', Kernel::VERSION],
68+
['End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')],
69+
['End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')],
7070
new TableSeparator(),
71-
array('<info>Kernel</>'),
71+
['<info>Kernel</>'],
7272
new TableSeparator(),
73-
array('Type', \get_class($kernel)),
74-
array('Environment', $kernel->getEnvironment()),
75-
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
76-
array('Charset', $kernel->getCharset()),
77-
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
78-
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
73+
['Type', \get_class($kernel)],
74+
['Environment', $kernel->getEnvironment()],
75+
['Debug', $kernel->isDebug() ? 'true' : 'false'],
76+
['Charset', $kernel->getCharset()],
77+
['Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'],
78+
['Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'],
7979
new TableSeparator(),
80-
array('<info>PHP</>'),
80+
['<info>PHP</>'],
8181
new TableSeparator(),
82-
array('Version', PHP_VERSION),
83-
array('Architecture', (PHP_INT_SIZE * 8).' bits'),
84-
array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'),
85-
array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'),
86-
array('OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
87-
array('APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
88-
array('Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'),
89-
);
82+
['Version', PHP_VERSION],
83+
['Architecture', (PHP_INT_SIZE * 8).' bits'],
84+
['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
85+
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'],
86+
['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
87+
['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
88+
['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'],
89+
];
9090

9191
if ($dotenv = self::getDotenvVars()) {
92-
$rows = array_merge($rows, array(
92+
$rows = array_merge($rows, [
9393
new TableSeparator(),
94-
array('<info>Environment (.env)</>'),
94+
['<info>Environment (.env)</>'],
9595
new TableSeparator(),
96-
), array_map(function ($value, $name) {
97-
return array($name, $value);
96+
], array_map(function ($value, $name) {
97+
return [$name, $value];
9898
}, $dotenv, array_keys($dotenv)));
9999
}
100100

101-
$io->table(array(), $rows);
101+
$io->table([], $rows);
102102
}
103103

104104
private static function formatPath(string $path, string $baseDir): string
@@ -129,7 +129,7 @@ private static function isExpired(string $date): bool
129129

130130
private static function getDotenvVars(): array
131131
{
132-
$vars = array();
132+
$vars = [];
133133
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
134134
if ('' !== $name && false !== $value = getenv($name)) {
135135
$vars[$name] = $value;

Command/ContainerDebugCommand.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ContainerDebugCommand extends Command
4848
protected function configure()
4949
{
5050
$this
51-
->setDefinition(array(
51+
->setDefinition([
5252
new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'),
5353
new InputOption('show-private', null, InputOption::VALUE_NONE, 'Used to show public *and* private services (deprecated)'),
5454
new InputOption('show-arguments', null, InputOption::VALUE_NONE, 'Used to show arguments in services'),
@@ -60,7 +60,7 @@ protected function configure()
6060
new InputOption('types', null, InputOption::VALUE_NONE, 'Displays types (classes/interfaces) available in the container'),
6161
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
6262
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
63-
))
63+
])
6464
->setDescription('Displays current services for an application')
6565
->setHelp(<<<'EOF'
6666
The <info>%command.name%</info> command displays all configured <comment>public</comment> services:
@@ -117,26 +117,26 @@ protected function execute(InputInterface $input, OutputInterface $output)
117117
$object = $this->getContainerBuilder();
118118

119119
if ($input->getOption('types')) {
120-
$options = array();
121-
$options['filter'] = array($this, 'filterToServiceTypes');
120+
$options = [];
121+
$options['filter'] = [$this, 'filterToServiceTypes'];
122122
} elseif ($input->getOption('parameters')) {
123-
$parameters = array();
123+
$parameters = [];
124124
foreach ($object->getParameterBag()->all() as $k => $v) {
125125
$parameters[$k] = $object->resolveEnvPlaceholders($v);
126126
}
127127
$object = new ParameterBag($parameters);
128-
$options = array();
128+
$options = [];
129129
} elseif ($parameter = $input->getOption('parameter')) {
130-
$options = array('parameter' => $parameter);
130+
$options = ['parameter' => $parameter];
131131
} elseif ($input->getOption('tags')) {
132-
$options = array('group_by' => 'tags');
132+
$options = ['group_by' => 'tags'];
133133
} elseif ($tag = $input->getOption('tag')) {
134-
$options = array('tag' => $tag);
134+
$options = ['tag' => $tag];
135135
} elseif ($name = $input->getArgument('name')) {
136136
$name = $this->findProperServiceName($input, $errorIo, $object, $name, $input->getOption('show-hidden'));
137-
$options = array('id' => $name);
137+
$options = ['id' => $name];
138138
} else {
139-
$options = array();
139+
$options = [];
140140
}
141141

142142
$helper = new DescriptorHelper();
@@ -150,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
150150
$helper->describe($io, $object, $options);
151151
} catch (ServiceNotFoundException $e) {
152152
if ('' !== $e->getId() && '@' === $e->getId()[0]) {
153-
throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, array(substr($e->getId(), 1)));
153+
throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, [substr($e->getId(), 1)]);
154154
}
155155

156156
throw $e;
@@ -174,7 +174,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
174174
*/
175175
protected function validateInput(InputInterface $input)
176176
{
177-
$options = array('tags', 'tag', 'parameters', 'parameter');
177+
$options = ['tags', 'tag', 'parameters', 'parameter'];
178178

179179
$optionsCount = 0;
180180
foreach ($options as $option) {
@@ -209,7 +209,7 @@ protected function getContainerBuilder()
209209
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
210210
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
211211
$container = $buildContainer();
212-
$container->getCompilerPassConfig()->setRemovingPasses(array());
212+
$container->getCompilerPassConfig()->setRemovingPasses([]);
213213
$container->compile();
214214
} else {
215215
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
@@ -239,7 +239,7 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
239239
private function findServiceIdsContaining(ContainerBuilder $builder, string $name, bool $showHidden)
240240
{
241241
$serviceIds = $builder->getServiceIds();
242-
$foundServiceIds = $foundServiceIdsIgnoringBackslashes = array();
242+
$foundServiceIds = $foundServiceIdsIgnoringBackslashes = [];
243243
foreach ($serviceIds as $serviceId) {
244244
if (!$showHidden && 0 === strpos($serviceId, '.')) {
245245
continue;

Command/DebugAutowiringCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class DebugAutowiringCommand extends ContainerDebugCommand
3535
protected function configure()
3636
{
3737
$this
38-
->setDefinition(array(
38+
->setDefinition([
3939
new InputArgument('search', InputArgument::OPTIONAL, 'A search filter'),
4040
new InputOption('all', null, InputOption::VALUE_NONE, 'Show also services that are not aliased'),
41-
))
41+
])
4242
->setDescription('Lists classes/interfaces you can use for autowiring')
4343
->setHelp(<<<'EOF'
4444
The <info>%command.name%</info> command displays the classes and interfaces that
@@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6565

6666
$builder = $this->getContainerBuilder();
6767
$serviceIds = $builder->getServiceIds();
68-
$serviceIds = array_filter($serviceIds, array($this, 'filterToServiceTypes'));
68+
$serviceIds = array_filter($serviceIds, [$this, 'filterToServiceTypes']);
6969

7070
if ($search = $input->getArgument('search')) {
7171
$serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
@@ -86,11 +86,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
if ($search) {
8787
$io->text(sprintf('(only showing classes/interfaces matching <comment>%s</comment>)', $search));
8888
}
89-
$hasAlias = array();
89+
$hasAlias = [];
9090
$all = $input->getOption('all');
9191
$previousId = '-';
9292
foreach ($serviceIds as $serviceId) {
93-
$text = array();
93+
$text = [];
9494
if (0 !== strpos($serviceId, $previousId)) {
9595
$text[] = '';
9696
if ('' !== $description = Descriptor::getClassDescription($serviceId, $serviceId)) {

Command/TranslationDebugCommand.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ public function __construct($translator, TranslationReaderInterface $reader, Ext
7474
protected function configure()
7575
{
7676
$this
77-
->setDefinition(array(
77+
->setDefinition([
7878
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
7979
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages'),
8080
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'The messages domain'),
8181
new InputOption('only-missing', null, InputOption::VALUE_NONE, 'Displays only missing messages'),
8282
new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'),
8383
new InputOption('all', null, InputOption::VALUE_NONE, 'Load messages from all registered bundles'),
84-
))
84+
])
8585
->setDescription('Displays translation messages information')
8686
->setHelp(<<<'EOF'
8787
The <info>%command.name%</info> command helps finding unused or missing translation
@@ -131,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
131131
$rootDir = $kernel->getContainer()->getParameter('kernel.root_dir');
132132

133133
// Define Root Paths
134-
$transPaths = array();
134+
$transPaths = [];
135135
if (is_dir($dir = $rootDir.'/Resources/translations')) {
136136
if ($dir !== $this->defaultTransPath) {
137137
$notice = sprintf('Storing translations in the "%s" directory is deprecated since Symfony 4.2, ', $dir);
@@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
142142
if ($this->defaultTransPath) {
143143
$transPaths[] = $this->defaultTransPath;
144144
}
145-
$viewsPaths = array();
145+
$viewsPaths = [];
146146
if (is_dir($dir = $rootDir.'/Resources/views')) {
147147
if ($dir !== $this->defaultViewsPath) {
148148
$notice = sprintf('Storing templates in the "%s" directory is deprecated since Symfony 4.2, ', $dir);
@@ -158,7 +158,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
158158
if (null !== $input->getArgument('bundle')) {
159159
try {
160160
$bundle = $kernel->getBundle($input->getArgument('bundle'));
161-
$transPaths = array($bundle->getPath().'/Resources/translations');
161+
$transPaths = [$bundle->getPath().'/Resources/translations'];
162162
if ($this->defaultTransPath) {
163163
$transPaths[] = $this->defaultTransPath;
164164
}
@@ -167,7 +167,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
167167
$notice = sprintf('Storing translations files for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $dir, $bundle->getName());
168168
@trigger_error($notice.($this->defaultTransPath ? sprintf('use the "%s" directory instead.', $this->defaultTransPath) : 'configure and use "framework.translator.default_path" instead.'), E_USER_DEPRECATED);
169169
}
170-
$viewsPaths = array($bundle->getPath().'/Resources/views');
170+
$viewsPaths = [$bundle->getPath().'/Resources/views'];
171171
if ($this->defaultViewsPath) {
172172
$viewsPaths[] = $this->defaultViewsPath;
173173
}
@@ -180,15 +180,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
180180
// such a bundle does not exist, so treat the argument as path
181181
$path = $input->getArgument('bundle');
182182

183-
$transPaths = array($path.'/translations');
183+
$transPaths = [$path.'/translations'];
184184
if (is_dir($dir = $path.'/Resources/translations')) {
185185
if ($dir !== $this->defaultTransPath) {
186186
@trigger_error(sprintf('Storing translations in the "%s" directory is deprecated since Symfony 4.2, use the "%s" directory instead.', $dir, $path.'/translations'), E_USER_DEPRECATED);
187187
}
188188
$transPaths[] = $dir;
189189
}
190190

191-
$viewsPaths = array($path.'/templates');
191+
$viewsPaths = [$path.'/templates'];
192192
if (is_dir($dir = $path.'/Resources/views')) {
193193
if ($dir !== $this->defaultViewsPath) {
194194
@trigger_error(sprintf('Storing templates in the "%s" directory is deprecated since Symfony 4.2, use the "%s" directory instead.', $dir, $path.'/templates'), E_USER_DEPRECATED);
@@ -227,7 +227,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
227227
$mergeOperation = new MergeOperation($extractedCatalogue, $currentCatalogue);
228228
$allMessages = $mergeOperation->getResult()->all($domain);
229229
if (null !== $domain) {
230-
$allMessages = array($domain => $allMessages);
230+
$allMessages = [$domain => $allMessages];
231231
}
232232

233233
// No defined or extracted messages
@@ -247,16 +247,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
247247
$fallbackCatalogues = $this->loadFallbackCatalogues($locale, $transPaths);
248248

249249
// Display header line
250-
$headers = array('State', 'Domain', 'Id', sprintf('Message Preview (%s)', $locale));
250+
$headers = ['State', 'Domain', 'Id', sprintf('Message Preview (%s)', $locale)];
251251
foreach ($fallbackCatalogues as $fallbackCatalogue) {
252252
$headers[] = sprintf('Fallback Message Preview (%s)', $fallbackCatalogue->getLocale());
253253
}
254-
$rows = array();
254+
$rows = [];
255255
// Iterate all message ids and determine their state
256256
foreach ($allMessages as $domain => $messages) {
257257
foreach (array_keys($messages) as $messageId) {
258258
$value = $currentCatalogue->get($messageId, $domain);
259-
$states = array();
259+
$states = [];
260260

261261
if ($extractedCatalogue->defines($messageId, $domain)) {
262262
if (!$currentCatalogue->defines($messageId, $domain)) {
@@ -279,7 +279,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
279279
}
280280
}
281281

282-
$row = array($this->formatStates($states), $domain, $this->formatId($messageId), $this->sanitizeString($value));
282+
$row = [$this->formatStates($states), $domain, $this->formatId($messageId), $this->sanitizeString($value)];
283283
foreach ($fallbackCatalogues as $fallbackCatalogue) {
284284
$row[] = $this->sanitizeString($fallbackCatalogue->get($messageId, $domain));
285285
}
@@ -310,7 +310,7 @@ private function formatState($state): string
310310

311311
private function formatStates(array $states): string
312312
{
313-
$result = array();
313+
$result = [];
314314
foreach ($states as $state) {
315315
$result[] = $this->formatState($state);
316316
}
@@ -367,7 +367,7 @@ private function loadCurrentMessages(string $locale, array $transPaths): Message
367367
*/
368368
private function loadFallbackCatalogues(string $locale, array $transPaths): array
369369
{
370-
$fallbackCatalogues = array();
370+
$fallbackCatalogues = [];
371371
if ($this->translator instanceof Translator || $this->translator instanceof DataCollectorTranslator || $this->translator instanceof LoggingTranslator) {
372372
foreach ($this->translator->getFallbackLocales() as $fallbackLocale) {
373373
if ($fallbackLocale === $locale) {

0 commit comments

Comments
 (0)