Skip to content

Commit 445fdbb

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: 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 d0a7229 + 4401fe8 commit 445fdbb

File tree

186 files changed

+933
-933
lines changed

Some content is hidden

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

186 files changed

+933
-933
lines changed

CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public function warmUp($cacheDir)
5454
{
5555
$arrayAdapter = new ArrayAdapter();
5656

57-
spl_autoload_register(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
57+
spl_autoload_register([PhpArrayAdapter::class, 'throwOnRequiredClass']);
5858
try {
5959
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
6060
return;
6161
}
6262
} finally {
63-
spl_autoload_unregister(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
63+
spl_autoload_unregister([PhpArrayAdapter::class, 'throwOnRequiredClass']);
6464
}
6565

6666
// 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
@@ -74,7 +74,7 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
7474
*/
7575
private function extractSupportedLoaders(array $loaders)
7676
{
77-
$supportedLoaders = array();
77+
$supportedLoaders = [];
7878

7979
foreach ($loaders as $loader) {
8080
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
@@ -85,7 +85,7 @@ protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array
8585
*/
8686
private function extractSupportedLoaders(array $loaders)
8787
{
88-
$supportedLoaders = array();
88+
$supportedLoaders = [];
8989

9090
foreach ($loaders as $loader) {
9191
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: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,46 +61,46 @@ protected function execute(InputInterface $input, OutputInterface $output)
6161
/** @var $kernel KernelInterface */
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('Name', $kernel->getName()),
75-
array('Environment', $kernel->getEnvironment()),
76-
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
77-
array('Charset', $kernel->getCharset()),
78-
array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
79-
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
80-
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
73+
['Type', \get_class($kernel)],
74+
['Name', $kernel->getName()],
75+
['Environment', $kernel->getEnvironment()],
76+
['Debug', $kernel->isDebug() ? 'true' : 'false'],
77+
['Charset', $kernel->getCharset()],
78+
['Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())],
79+
['Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'],
80+
['Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'],
8181
new TableSeparator(),
82-
array('<info>PHP</>'),
82+
['<info>PHP</>'],
8383
new TableSeparator(),
84-
array('Version', PHP_VERSION),
85-
array('Architecture', (PHP_INT_SIZE * 8).' bits'),
86-
array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'),
87-
array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'),
88-
array('OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
89-
array('APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
90-
array('Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'),
91-
);
84+
['Version', PHP_VERSION],
85+
['Architecture', (PHP_INT_SIZE * 8).' bits'],
86+
['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
87+
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'],
88+
['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
89+
['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
90+
['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'],
91+
];
9292

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

103-
$io->table(array(), $rows);
103+
$io->table([], $rows);
104104
}
105105

106106
private static function formatPath(string $path, string $baseDir = null): string
@@ -131,7 +131,7 @@ private static function isExpired(string $date): bool
131131

132132
private static function getDotenvVars(): array
133133
{
134-
$vars = array();
134+
$vars = [];
135135
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
136136
if ('' !== $name && false !== $value = getenv($name)) {
137137
$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
@@ -55,9 +55,9 @@ public function __construct(Filesystem $filesystem)
5555
protected function configure()
5656
{
5757
$this
58-
->setDefinition(array(
58+
->setDefinition([
5959
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', null),
60-
))
60+
])
6161
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
6262
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
6363
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
@@ -123,10 +123,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
123123

124124
$io->newLine();
125125

126-
$rows = array();
126+
$rows = [];
127127
$copyUsed = false;
128128
$exitCode = 0;
129-
$validAssetDirs = array();
129+
$validAssetDirs = [];
130130
/** @var BundleInterface $bundle */
131131
foreach ($kernel->getBundles() as $bundle) {
132132
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
@@ -159,13 +159,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
159159
}
160160

161161
if ($method === $expectedMethod) {
162-
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
162+
$rows[] = [sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method];
163163
} else {
164-
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
164+
$rows[] = [sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method];
165165
}
166166
} catch (\Exception $e) {
167167
$exitCode = 1;
168-
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
168+
$rows[] = [sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage()];
169169
}
170170
}
171171
// remove the assets of the bundles that no longer exist
@@ -175,7 +175,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
175175
}
176176

177177
if ($rows) {
178-
$io->table(array('', 'Bundle', 'Method / Error'), $rows);
178+
$io->table(['', 'Bundle', 'Method / Error'], $rows);
179179
}
180180

181181
if (0 !== $exitCode) {

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/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

Command/EventDispatcherDebugCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function __construct(EventDispatcherInterface $dispatcher)
4545
protected function configure()
4646
{
4747
$this
48-
->setDefinition(array(
48+
->setDefinition([
4949
new InputArgument('event', InputArgument::OPTIONAL, 'An event name'),
5050
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
5151
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
52-
))
52+
])
5353
->setDescription('Displays configured listeners for an application')
5454
->setHelp(<<<'EOF'
5555
The <info>%command.name%</info> command displays all configured listeners:
@@ -73,15 +73,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
7373
{
7474
$io = new SymfonyStyle($input, $output);
7575

76-
$options = array();
76+
$options = [];
7777
if ($event = $input->getArgument('event')) {
7878
if (!$this->dispatcher->hasListeners($event)) {
7979
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
8080

8181
return;
8282
}
8383

84-
$options = array('event' => $event);
84+
$options = ['event' => $event];
8585
}
8686

8787
$helper = new DescriptorHelper();

Command/RouterMatchCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function __construct(RouterInterface $router)
4747
protected function configure()
4848
{
4949
$this
50-
->setDefinition(array(
50+
->setDefinition([
5151
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
5252
new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method'),
5353
new InputOption('scheme', null, InputOption::VALUE_REQUIRED, 'Sets the URI scheme (usually http or https)'),
5454
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the URI host'),
55-
))
55+
])
5656
->setDescription('Helps debug routes by simulating a path info match')
5757
->setHelp(<<<'EOF'
5858
The <info>%command.name%</info> shows which routes match a given request and which don't and for what reason:
@@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
$io->success(sprintf('Route "%s" matches', $trace['name']));
101101

102102
$routerDebugCommand = $this->getApplication()->find('debug:router');
103-
$routerDebugCommand->run(new ArrayInput(array('name' => $trace['name'])), $output);
103+
$routerDebugCommand->run(new ArrayInput(['name' => $trace['name']]), $output);
104104

105105
$matches = true;
106106
} elseif ($input->getOption('verbose')) {

0 commit comments

Comments
 (0)