Skip to content

Commit 795e6dc

Browse files
committed
Move to short array syntax
1 parent 94cde44 commit 795e6dc

File tree

85 files changed

+941
-941
lines changed

Some content is hidden

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

85 files changed

+941
-941
lines changed

.php_cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ return Symfony\CS\Config\Config::create()
2020
->fixers(array(
2121
'combine_consecutive_unsets',
2222
'header_comment',
23-
'long_array_syntax',
23+
'short_array_syntax',
2424
'newline_after_open_tag',
2525
'no_php4_constructor',
2626
'no_useless_else',

Command/PopulateCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
103103
$reset = !$input->getOption('no-reset');
104104
$delete = !$input->getOption('no-delete');
105105

106-
$options = array(
106+
$options = [
107107
'delete' => $delete,
108108
'reset' => $reset,
109109
'ignore_errors' => $input->getOption('ignore-errors'),
110110
'offset' => $input->getOption('offset'),
111111
'sleep' => $input->getOption('sleep'),
112-
);
112+
];
113113

114114
if ($input->getOption('batch-size')) {
115115
$options['batch_size'] = (int) $input->getOption('batch-size');

Command/ProgressClosureBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ProgressClosureBuilder
4040
public function build(OutputInterface $output, $action, $index, $type, $offset)
4141
{
4242
if (!class_exists('Symfony\Component\Console\Helper\ProgressBar') ||
43-
!is_callable(array('Symfony\Component\Console\Helper\ProgressBar', 'getProgress'))) {
43+
!is_callable(['Symfony\Component\Console\Helper\ProgressBar', 'getProgress'])) {
4444
return $this->buildLegacy($output, $action, $index, $type, $offset);
4545
}
4646

Command/ResetCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7575
} else {
7676
$indexes = null === $index
7777
? array_keys($this->indexManager->getAllIndexes())
78-
: array($index)
78+
: [$index]
7979
;
8080

8181
foreach ($indexes as $index) {

Configuration/ConfigManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConfigManager implements ManagerInterface
2828
/**
2929
* @var IndexConfig[]
3030
*/
31-
private $indexes = array();
31+
private $indexes = [];
3232

3333
/**
3434
* @param Source\SourceInterface[] $sources

Configuration/IndexConfig.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct($name, array $types, array $config)
7070
{
7171
$this->elasticSearchName = isset($config['elasticSearchName']) ? $config['elasticSearchName'] : $name;
7272
$this->name = $name;
73-
$this->settings = isset($config['settings']) ? $config['settings'] : array();
73+
$this->settings = isset($config['settings']) ? $config['settings'] : [];
7474
$this->types = $types;
7575
$this->useAlias = isset($config['useAlias']) ? $config['useAlias'] : false;
7676
}

Configuration/Source/ContainerSource.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public function __construct(array $configArray)
5050
*/
5151
public function getConfiguration()
5252
{
53-
$indexes = array();
53+
$indexes = [];
5454
foreach ($this->configArray as $config) {
5555
$types = $this->getTypes($config);
56-
$index = new IndexConfig($config['name'], $types, array(
56+
$index = new IndexConfig($config['name'], $types, [
5757
'elasticSearchName' => $config['elasticsearch_name'],
5858
'settings' => $config['settings'],
5959
'useAlias' => $config['use_alias'],
60-
));
60+
]);
6161

6262
$indexes[$config['name']] = $index;
6363
}
@@ -74,7 +74,7 @@ public function getConfiguration()
7474
*/
7575
protected function getTypes($config)
7676
{
77-
$types = array();
77+
$types = [];
7878

7979
if (isset($config['types'])) {
8080
foreach ($config['types'] as $typeConfig) {

Configuration/TypeConfig.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TypeConfig
4242
* @param array $mapping
4343
* @param array $config
4444
*/
45-
public function __construct($name, array $mapping, array $config = array())
45+
public function __construct($name, array $mapping, array $config = [])
4646
{
4747
$this->config = $config;
4848
$this->mapping = $mapping;

DependencyInjection/Compiler/ConfigSourcePass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function process(ContainerBuilder $container)
3535
return;
3636
}
3737

38-
$sources = array();
38+
$sources = [];
3939
foreach (array_keys($container->findTaggedServiceIds('fos_elastica.config_source')) as $id) {
4040
$sources[] = new Reference($id);
4141
}

DependencyInjection/Compiler/IndexPass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function process(ContainerBuilder $container)
3535
return;
3636
}
3737

38-
$indexes = array();
38+
$indexes = [];
3939
foreach ($container->findTaggedServiceIds('fos_elastica.index') as $id => $tags) {
4040
foreach ($tags as $tag) {
4141
$indexes[$tag['name']] = new Reference($id);

DependencyInjection/Compiler/RegisterProvidersPass.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RegisterProvidersPass implements CompilerPassInterface
2222
*
2323
* @var array
2424
*/
25-
private $implementations = array();
25+
private $implementations = [];
2626

2727
/**
2828
* @see Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()
@@ -39,7 +39,7 @@ public function process(ContainerBuilder $container)
3939
$registry = $container->getDefinition('fos_elastica.provider_registry');
4040
$providers = $container->findTaggedServiceIds('fos_elastica.provider');
4141

42-
$providersByPriority = array();
42+
$providersByPriority = [];
4343
foreach ($providers as $id => $attributes) {
4444
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
4545
$providersByPriority[$priority][$id] = $attributes;
@@ -67,7 +67,7 @@ public function process(ContainerBuilder $container)
6767
$type = $tag['type'];
6868
}
6969

70-
$registry->addMethodCall('addProvider', array($index, $type, $providerId));
70+
$registry->addMethodCall('addProvider', [$index, $type, $providerId]);
7171
}
7272
}
7373

DependencyInjection/Compiler/TransformerPass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function process(ContainerBuilder $container)
3232
return;
3333
}
3434

35-
$transformers = array();
35+
$transformers = [];
3636

3737
foreach ($container->findTaggedServiceIds('fos_elastica.elastica_to_model_transformer') as $id => $tags) {
3838
foreach ($tags as $tag) {

DependencyInjection/Configuration.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Configuration implements ConfigurationInterface
2222
*
2323
* @var array
2424
*/
25-
private $supportedDrivers = array('orm', 'mongodb', 'propel', 'phpcr');
25+
private $supportedDrivers = ['orm', 'mongodb', 'propel', 'phpcr'];
2626

2727
/**
2828
* If the kernel is running in debug mode.
@@ -59,7 +59,7 @@ public function getConfigTreeBuilder()
5959
->end()
6060
->scalarNode('default_manager')->defaultValue('orm')->end()
6161
->arrayNode('serializer')
62-
->treatNullLike(array())
62+
->treatNullLike([])
6363
->children()
6464
->scalarNode('callback_class')->defaultValue('FOS\ElasticaBundle\Serializer\Callback')->end()
6565
->scalarNode('serializer')->defaultValue('serializer')->end()
@@ -101,9 +101,9 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
101101
return is_array($v) && !array_key_exists('connections', $v);
102102
})
103103
->then(function ($v) {
104-
return array(
105-
'connections' => array($v),
106-
);
104+
return [
105+
'connections' => [$v],
106+
];
107107
})
108108
->end()
109109
->children()
@@ -191,7 +191,7 @@ private function addIndexesSection(ArrayNodeDefinition $rootNode)
191191
->append($this->getSerializerNode())
192192
->end()
193193
->end()
194-
->variableNode('settings')->defaultValue(array())->end()
194+
->variableNode('settings')->defaultValue([])->end()
195195
->end()
196196
->append($this->getTypesNode())
197197
->end()
@@ -211,7 +211,7 @@ protected function getTypesNode()
211211
$node
212212
->useAttributeAsKey('name')
213213
->prototype('array')
214-
->treatNullLike(array())
214+
->treatNullLike([])
215215
->beforeNormalization()
216216
->ifNull()
217217
->thenEmptyArray()
@@ -223,7 +223,7 @@ protected function getTypesNode()
223223
return isset($v['dynamic_templates']);
224224
})
225225
->then(function ($v) {
226-
$dt = array();
226+
$dt = [];
227227
foreach ($v['dynamic_templates'] as $key => $type) {
228228
if (is_int($key)) {
229229
$dt[] = $type;
@@ -271,7 +271,7 @@ protected function getPropertiesNode()
271271
$node
272272
->useAttributeAsKey('name')
273273
->prototype('variable')
274-
->treatNullLike(array());
274+
->treatNullLike([]);
275275

276276
return $node;
277277
}
@@ -296,7 +296,7 @@ public function getDynamicTemplateNode()
296296
->scalarNode('match_pattern')->end()
297297
->arrayNode('mapping')
298298
->prototype('variable')
299-
->treatNullLike(array())
299+
->treatNullLike([])
300300
->end()
301301
->end()
302302
->end()
@@ -524,7 +524,7 @@ protected function getSerializerNode()
524524
->addDefaultsIfNotSet()
525525
->children()
526526
->arrayNode('groups')
527-
->treatNullLike(array())
527+
->treatNullLike([])
528528
->prototype('scalar')->end()
529529
->end()
530530
->scalarNode('version')->end()

0 commit comments

Comments
 (0)