Skip to content

Commit

Permalink
switched array() to []
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 16, 2019
1 parent 38042a3 commit ce7ef30
Show file tree
Hide file tree
Showing 218 changed files with 2,074 additions and 2,074 deletions.
4 changes: 2 additions & 2 deletions CacheWarmer/AbstractPhpFileCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function warmUp($cacheDir)
{
$arrayAdapter = new ArrayAdapter();

spl_autoload_register(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
spl_autoload_register([PhpArrayAdapter::class, 'throwOnRequiredClass']);
try {
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
return;
}
} finally {
spl_autoload_unregister(array(PhpArrayAdapter::class, 'throwOnRequiredClass'));
spl_autoload_unregister([PhpArrayAdapter::class, 'throwOnRequiredClass']);
}

// the ArrayAdapter stores the values serialized
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/RouterCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public function isOptional()
*/
public static function getSubscribedServices()
{
return array(
return [
'router' => RouterInterface::class,
);
];
}
}
2 changes: 1 addition & 1 deletion CacheWarmer/SerializerCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
*/
private function extractSupportedLoaders(array $loaders)
{
$supportedLoaders = array();
$supportedLoaders = [];

foreach ($loaders as $loader) {
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/TemplateFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function findAllTemplates()
return $this->templates;
}

$templates = array();
$templates = [];

foreach ($this->kernel->getBundles() as $bundle) {
$templates = array_merge($templates, $this->findTemplatesInBundle($bundle));
Expand All @@ -72,7 +72,7 @@ public function findAllTemplates()
*/
private function findTemplatesInFolder($dir)
{
$templates = array();
$templates = [];

if (is_dir($dir)) {
$finder = new Finder();
Expand Down
2 changes: 1 addition & 1 deletion CacheWarmer/TemplatePathsCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(TemplateFinderInterface $finder, TemplateLocator $lo
public function warmUp($cacheDir)
{
$filesystem = new Filesystem();
$templates = array();
$templates = [];

foreach ($this->finder->findAllTemplates() as $template) {
$templates[$template->getLogicalName()] = rtrim($filesystem->makePathRelative($this->locator->locate($template), $cacheDir), '/');
Expand Down
4 changes: 2 additions & 2 deletions CacheWarmer/TranslationsCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public function isOptional()
*/
public static function getSubscribedServices()
{
return array(
return [
'translator' => TranslatorInterface::class,
);
];
}
}
2 changes: 1 addition & 1 deletion CacheWarmer/ValidatorCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array
*/
private function extractSupportedLoaders(array $loaders)
{
$supportedLoaders = array();
$supportedLoaders = [];

foreach ($loaders as $loader) {
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
Expand Down
2 changes: 1 addition & 1 deletion Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Client extends BaseClient
/**
* {@inheritdoc}
*/
public function __construct(KernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
public function __construct(KernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
{
parent::__construct($kernel, $server, $history, $cookieJar);
}
Expand Down
58 changes: 29 additions & 29 deletions Command/AboutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,46 +60,46 @@ protected function execute(InputInterface $input, OutputInterface $output)
/** @var $kernel KernelInterface */
$kernel = $this->getApplication()->getKernel();

$rows = array(
array('<info>Symfony</>'),
$rows = [
['<info>Symfony</>'],
new TableSeparator(),
array('Version', Kernel::VERSION),
array('End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')),
array('End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')),
['Version', Kernel::VERSION],
['End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')],
['End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')],
new TableSeparator(),
array('<info>Kernel</>'),
['<info>Kernel</>'],
new TableSeparator(),
array('Type', \get_class($kernel)),
array('Name', $kernel->getName()),
array('Environment', $kernel->getEnvironment()),
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
array('Charset', $kernel->getCharset()),
array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
['Type', \get_class($kernel)],
['Name', $kernel->getName()],
['Environment', $kernel->getEnvironment()],
['Debug', $kernel->isDebug() ? 'true' : 'false'],
['Charset', $kernel->getCharset()],
['Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())],
['Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'],
['Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'],
new TableSeparator(),
array('<info>PHP</>'),
['<info>PHP</>'],
new TableSeparator(),
array('Version', PHP_VERSION),
array('Architecture', (PHP_INT_SIZE * 8).' bits'),
array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'),
array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'),
array('OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
array('APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'),
array('Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'),
);
['Version', PHP_VERSION],
['Architecture', (PHP_INT_SIZE * 8).' bits'],
['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'],
['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'],
];

if ($dotenv = self::getDotenvVars()) {
$rows = array_merge($rows, array(
$rows = array_merge($rows, [
new TableSeparator(),
array('<info>Environment (.env)</>'),
['<info>Environment (.env)</>'],
new TableSeparator(),
), array_map(function ($value, $name) {
return array($name, $value);
], array_map(function ($value, $name) {
return [$name, $value];
}, $dotenv, array_keys($dotenv)));
}

$io->table(array(), $rows);
$io->table([], $rows);
}

private static function formatPath($path, $baseDir = null)
Expand Down Expand Up @@ -130,7 +130,7 @@ private static function isExpired($date)

private static function getDotenvVars()
{
$vars = array();
$vars = [];
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$vars[$name] = $value;
Expand Down
6 changes: 3 additions & 3 deletions Command/AbstractConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
protected function listBundles($output)
{
$title = 'Available registered bundles with their extension alias if available';
$headers = array('Bundle name', 'Extension alias');
$rows = array();
$headers = ['Bundle name', 'Extension alias'];
$rows = [];

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

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

if ($output instanceof StyleInterface) {
Expand Down
16 changes: 8 additions & 8 deletions Command/AssetsInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public function __construct($filesystem = null)
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', null),
))
])
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
->setDescription('Installs bundles web assets under a public directory')
Expand Down Expand Up @@ -144,10 +144,10 @@ protected function execute(InputInterface $input, OutputInterface $output)

$io->newLine();

$rows = array();
$rows = [];
$copyUsed = false;
$exitCode = 0;
$validAssetDirs = array();
$validAssetDirs = [];
/** @var BundleInterface $bundle */
foreach ($kernel->getBundles() as $bundle) {
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
Expand Down Expand Up @@ -180,13 +180,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

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

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

if (0 !== $exitCode) {
Expand Down
8 changes: 4 additions & 4 deletions Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function __construct($cacheClearer = null, Filesystem $filesystem = null)
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
))
])
->setDescription('Clears the cache')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command clears the application cache for a given environment
Expand Down Expand Up @@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ('/' === \DIRECTORY_SEPARATOR && $mounts = @file('/proc/mounts')) {
foreach ($mounts as $mount) {
$mount = \array_slice(explode(' ', $mount), 1, -3);
if (!\in_array(array_pop($mount), array('vboxsf', 'nfs'))) {
if (!\in_array(array_pop($mount), ['vboxsf', 'nfs'])) {
continue;
}
$mount = implode(' ', $mount).'/';
Expand Down Expand Up @@ -222,7 +222,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
$warmer->warmUp($warmupDir);

// fix references to cached files with the real cache directory name
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
$search = [$warmupDir, str_replace('\\', '\\\\', $warmupDir)];
$replace = str_replace('\\', '/', $realCacheDir);
foreach (Finder::create()->files()->in($warmupDir) as $file) {
$content = str_replace($search, $replace, file_get_contents($file), $count);
Expand Down
8 changes: 4 additions & 4 deletions Command/CachePoolClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function __construct($poolClearer = null)
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of cache pools or cache pool clearers'),
))
])
->setDescription('Clears cache pools')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command clears the given cache pools or cache pool clearers.
Expand All @@ -80,8 +80,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

$io = new SymfonyStyle($input, $output);
$kernel = $this->getApplication()->getKernel();
$pools = array();
$clearers = array();
$pools = [];
$clearers = [];

foreach ($input->getArgument('pools') as $id) {
if ($this->poolClearer->hasPool($id)) {
Expand Down
4 changes: 2 additions & 2 deletions Command/CacheWarmupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function __construct($cacheWarmer = null)
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
))
])
->setDescription('Warms up an empty cache')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command warms up the cache.
Expand Down
6 changes: 3 additions & 3 deletions Command/ConfigDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class ConfigDebugCommand extends AbstractConfigCommand
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
))
])
->setDescription('Dumps the current configuration for an extension')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command dumps the current configuration for an
Expand Down Expand Up @@ -94,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
sprintf('Current configuration for %s', ($name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name)))
);

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

return;
}
Expand Down
10 changes: 5 additions & 5 deletions Command/ConfigDumpReferenceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class ConfigDumpReferenceCommand extends AbstractConfigCommand
protected function configure()
{
$this
->setDefinition(array(
->setDefinition([
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'),
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'),
))
])
->setDescription('Dumps the default configuration for an extension')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command dumps the default configuration for an
Expand Down Expand Up @@ -81,17 +81,17 @@ protected function execute(InputInterface $input, OutputInterface $output)

if (null === $name = $input->getArgument('name')) {
$this->listBundles($errorIo);
$errorIo->comment(array(
$errorIo->comment([
'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>)',
'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)',
));
]);

return;
}

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

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

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

Expand Down
Loading

0 comments on commit ce7ef30

Please sign in to comment.