Skip to content

Commit 8a4c162

Browse files
committed
Merge branch '4.2' into short-array-master
* 4.2: fixed CS fixed CS 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 7c58a04 + 0bf225b commit 8a4c162

File tree

246 files changed

+2167
-2167
lines changed

Some content is hidden

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

246 files changed

+2167
-2167
lines changed

CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public function warmUp($cacheDir)
4646
{
4747
$arrayAdapter = new ArrayAdapter();
4848

49-
spl_autoload_register(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
49+
spl_autoload_register([PhpArrayAdapter::class, 'throwOnRequiredClass']);
5050
try {
5151
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
5252
return;
5353
}
5454
} finally {
55-
spl_autoload_unregister(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
55+
spl_autoload_unregister([PhpArrayAdapter::class, 'throwOnRequiredClass']);
5656
}
5757

5858
// the ArrayAdapter stores the values serialized

CacheWarmer/RouterCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function isOptional()
6767
*/
6868
public static function getSubscribedServices()
6969
{
70-
return array(
70+
return [
7171
'router' => RouterInterface::class,
72-
);
72+
];
7373
}
7474
}

CacheWarmer/SerializerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
7676
*/
7777
private function extractSupportedLoaders(array $loaders)
7878
{
79-
$supportedLoaders = array();
79+
$supportedLoaders = [];
8080

8181
foreach ($loaders as $loader) {
8282
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {

CacheWarmer/TemplateFinder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function findAllTemplates()
5252
return $this->templates;
5353
}
5454

55-
$templates = array();
55+
$templates = [];
5656

5757
foreach ($this->kernel->getBundles() as $bundle) {
5858
$templates = array_merge($templates, $this->findTemplatesInBundle($bundle));
@@ -72,7 +72,7 @@ public function findAllTemplates()
7272
*/
7373
private function findTemplatesInFolder($dir)
7474
{
75-
$templates = array();
75+
$templates = [];
7676

7777
if (is_dir($dir)) {
7878
$finder = new Finder();

CacheWarmer/TemplatePathsCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(TemplateFinderInterface $finder, TemplateLocator $lo
3939
public function warmUp($cacheDir)
4040
{
4141
$filesystem = new Filesystem();
42-
$templates = array();
42+
$templates = [];
4343

4444
foreach ($this->finder->findAllTemplates() as $template) {
4545
$templates[$template->getLogicalName()] = rtrim($filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');

CacheWarmer/TranslationsCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public function isOptional()
6060
*/
6161
public static function getSubscribedServices()
6262
{
63-
return array(
63+
return [
6464
'translator' => TranslatorInterface::class,
65-
);
65+
];
6666
}
6767
}

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array
8686
*/
8787
private function extractSupportedLoaders(array $loaders)
8888
{
89-
$supportedLoaders = array();
89+
$supportedLoaders = [];
9090

9191
foreach ($loaders as $loader) {
9292
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {

Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Client extends BaseClient
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function __construct(KernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
37+
public function __construct(KernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
3838
{
3939
parent::__construct($kernel, $server, $history, $cookieJar);
4040
}

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/AbstractConfigCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
2929
protected function listBundles($output)
3030
{
3131
$title = 'Available registered bundles with their extension alias if available';
32-
$headers = array('Bundle name', 'Extension alias');
33-
$rows = array();
32+
$headers = ['Bundle name', 'Extension alias'];
33+
$rows = [];
3434

3535
$bundles = $this->getApplication()->getKernel()->getBundles();
3636
usort($bundles, function ($bundleA, $bundleB) {
@@ -39,7 +39,7 @@ protected function listBundles($output)
3939

4040
foreach ($bundles as $bundle) {
4141
$extension = $bundle->getContainerExtension();
42-
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
42+
$rows[] = [$bundle->getName(), $extension ? $extension->getAlias() : ''];
4343
}
4444

4545
if ($output instanceof StyleInterface) {

Command/AssetsInstallCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public function __construct(Filesystem $filesystem, string $projectDir = null)
6262
protected function configure()
6363
{
6464
$this
65-
->setDefinition(array(
65+
->setDefinition([
6666
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', null),
67-
))
67+
])
6868
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
6969
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
7070
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
@@ -131,10 +131,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
131131

132132
$io->newLine();
133133

134-
$rows = array();
134+
$rows = [];
135135
$copyUsed = false;
136136
$exitCode = 0;
137-
$validAssetDirs = array();
137+
$validAssetDirs = [];
138138
/** @var BundleInterface $bundle */
139139
foreach ($kernel->getBundles() as $bundle) {
140140
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
@@ -167,13 +167,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
167167
}
168168

169169
if ($method === $expectedMethod) {
170-
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
170+
$rows[] = [sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method];
171171
} else {
172-
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
172+
$rows[] = [sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method];
173173
}
174174
} catch (\Exception $e) {
175175
$exitCode = 1;
176-
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
176+
$rows[] = [sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage()];
177177
}
178178
}
179179
// remove the assets of the bundles that no longer exist
@@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
183183
}
184184

185185
if ($rows) {
186-
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
186+
$io->table(['', 'Bundle', 'Method / Error'], $rows);
187187
}
188188

189189
if (0 !== $exitCode) {

Command/CacheClearCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function __construct(CacheClearerInterface $cacheClearer, Filesystem $fil
5353
protected function configure()
5454
{
5555
$this
56-
->setDefinition(array(
56+
->setDefinition([
5757
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
5858
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
59-
))
59+
])
6060
->setDescription('Clears the cache')
6161
->setHelp(<<<'EOF'
6262
The <info>%command.name%</info> command clears the application cache for a given environment
@@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
137137
if ('/' === \DIRECTORY_SEPARATOR && $mounts = @file('/proc/mounts')) {
138138
foreach ($mounts as $mount) {
139139
$mount = \array_slice(explode(' ', $mount), 1, -3);
140-
if (!\in_array(array_pop($mount), array('vboxsf', 'nfs'))) {
140+
if (!\in_array(array_pop($mount), ['vboxsf', 'nfs'])) {
141141
continue;
142142
}
143143
$mount = implode(' ', $mount).'/';
@@ -195,7 +195,7 @@ private function warmup(string $warmupDir, string $realCacheDir, bool $enableOpt
195195
}
196196

197197
// fix references to cached files with the real cache directory name
198-
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
198+
$search = [$warmupDir, str_replace('\\', '\\\\', $warmupDir)];
199199
$replace = str_replace('\\', '/', $realCacheDir);
200200
foreach (Finder::create()->files()->in($warmupDir) as $file) {
201201
$content = str_replace($search, $replace, file_get_contents($file), $count);

Command/CachePoolClearCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public function __construct(Psr6CacheClearer $poolClearer)
4444
protected function configure()
4545
{
4646
$this
47-
->setDefinition(array(
47+
->setDefinition([
4848
new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of cache pools or cache pool clearers'),
49-
))
49+
])
5050
->setDescription('Clears cache pools')
5151
->setHelp(<<<'EOF'
5252
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
@@ -64,8 +64,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6464
{
6565
$io = new SymfonyStyle($input, $output);
6666
$kernel = $this->getApplication()->getKernel();
67-
$pools = array();
68-
$clearers = array();
67+
$pools = [];
68+
$clearers = [];
6969

7070
foreach ($input->getArgument('pools') as $id) {
7171
if ($this->poolClearer->hasPool($id)) {

Command/CachePoolDeleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public function __construct(Psr6CacheClearer $poolClearer)
4242
protected function configure()
4343
{
4444
$this
45-
->setDefinition(array(
45+
->setDefinition([
4646
new InputArgument('pool', InputArgument::REQUIRED, 'The cache pool from which to delete an item'),
4747
new InputArgument('key', InputArgument::REQUIRED, 'The cache key to delete from the pool'),
48-
))
48+
])
4949
->setDescription('Deletes an item from a cache pool')
5050
->setHelp(<<<'EOF'
5151
The <info>%command.name%</info> deletes an item from a given cache pool.

Command/CacheWarmupCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public function __construct(CacheWarmerAggregate $cacheWarmer)
4444
protected function configure()
4545
{
4646
$this
47-
->setDefinition(array(
47+
->setDefinition([
4848
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
49-
))
49+
])
5050
->setDescription('Warms up an empty cache')
5151
->setHelp(<<<'EOF'
5252
The <info>%command.name%</info> command warms up the cache.

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class ConfigDebugCommand extends AbstractConfigCommand
3737
protected function configure()
3838
{
3939
$this
40-
->setDefinition(array(
40+
->setDefinition([
4141
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
4242
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
43-
))
43+
])
4444
->setDescription('Dumps the current configuration for an extension')
4545
->setHelp(<<<'EOF'
4646
The <info>%command.name%</info> command dumps the current configuration for an
@@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9595
sprintf('Current configuration for %s', ($name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name)))
9696
);
9797

98-
$io->writeln(Yaml::dump(array($extensionAlias => $config), 10));
98+
$io->writeln(Yaml::dump([$extensionAlias => $config], 10));
9999

100100
return;
101101
}

Command/ConfigDumpReferenceCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class ConfigDumpReferenceCommand extends AbstractConfigCommand
3939
protected function configure()
4040
{
4141
$this
42-
->setDefinition(array(
42+
->setDefinition([
4343
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'),
4444
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
4545
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'),
46-
))
46+
])
4747
->setDescription('Dumps the default configuration for an extension')
4848
->setHelp(<<<'EOF'
4949
The <info>%command.name%</info> command dumps the default configuration for an
@@ -81,17 +81,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
8181

8282
if (null === $name = $input->getArgument('name')) {
8383
$this->listBundles($errorIo);
84-
$errorIo->comment(array(
84+
$errorIo->comment([
8585
'Provide the name of a bundle as the first argument of this command to dump its default configuration. (e.g. <comment>config:dump-reference FrameworkBundle</comment>)',
8686
'For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>config:dump-reference FrameworkBundle profiler.matcher</comment> to dump the <comment>framework.profiler.matcher</comment> configuration)',
87-
));
87+
]);
8888

8989
return;
9090
}
9191

9292
$extension = $this->findExtension($name);
9393

94-
$configuration = $extension->getConfiguration(array(), $this->getContainerBuilder());
94+
$configuration = $extension->getConfiguration([], $this->getContainerBuilder());
9595

9696
$this->validateConfiguration($extension, $configuration);
9797

0 commit comments

Comments
 (0)