Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13738f2

Browse filesBrowse files
committed
Hunk-level array short syntax
1 parent f0bee9b commit 13738f2
Copy full SHA for 13738f2

File tree

Expand file treeCollapse file tree

420 files changed

+7149
-7149
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

420 files changed

+7149
-7149
lines changed

‎src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DoctrineDataCollector extends DataCollector
3333
/**
3434
* @var DebugStack[]
3535
*/
36-
private $loggers = array();
36+
private $loggers = [];
3737

3838
public function __construct(ManagerRegistry $registry)
3939
{
@@ -58,24 +58,24 @@ public function addLogger($name, DebugStack $logger)
5858
*/
5959
public function collect(Request $request, Response $response, \Exception $exception = null)
6060
{
61-
$queries = array();
61+
$queries = [];
6262
foreach ($this->loggers as $name => $logger) {
6363
$queries[$name] = $this->sanitizeQueries($name, $logger->queries);
6464
}
6565

66-
$this->data = array(
66+
$this->data = [
6767
'queries' => $queries,
6868
'connections' => $this->connections,
6969
'managers' => $this->managers,
70-
);
70+
];
7171
}
7272

7373
public function reset()
7474
{
75-
$this->data = array();
75+
$this->data = [];
7676

7777
foreach ($this->loggers as $logger) {
78-
$logger->queries = array();
78+
$logger->queries = [];
7979
$logger->currentQuery = 0;
8080
}
8181
}
@@ -133,10 +133,10 @@ private function sanitizeQuery($connectionName, $query)
133133
{
134134
$query['explainable'] = true;
135135
if (null === $query['params']) {
136-
$query['params'] = array();
136+
$query['params'] = [];
137137
}
138138
if (!\is_array($query['params'])) {
139-
$query['params'] = array($query['params']);
139+
$query['params'] = [$query['params']];
140140
}
141141
foreach ($query['params'] as $j => $param) {
142142
if (isset($query['types'][$j])) {

‎src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
+24-24Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ abstract class AbstractDoctrineExtension extends Extension
2727
/**
2828
* Used inside metadata driver method to simplify aggregation of data.
2929
*/
30-
protected $aliasMap = array();
30+
protected $aliasMap = [];
3131

3232
/**
3333
* Used inside metadata driver method to simplify aggregation of data.
3434
*/
35-
protected $drivers = array();
35+
protected $drivers = [];
3636

3737
/**
3838
* @param array $objectManager A configured object manager
@@ -46,10 +46,10 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
4646
// automatically register bundle mappings
4747
foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
4848
if (!isset($objectManager['mappings'][$bundle])) {
49-
$objectManager['mappings'][$bundle] = array(
49+
$objectManager['mappings'][$bundle] = [
5050
'mapping' => true,
5151
'is_bundle' => true,
52-
);
52+
];
5353
}
5454
}
5555
}
@@ -59,11 +59,11 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
5959
continue;
6060
}
6161

62-
$mappingConfig = array_replace(array(
62+
$mappingConfig = array_replace([
6363
'dir' => false,
6464
'type' => false,
6565
'prefix' => false,
66-
), (array) $mappingConfig);
66+
], (array) $mappingConfig);
6767

6868
$mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);
6969
// a bundle configuration is detected by realizing that the specified dir is not absolute and existing
@@ -153,7 +153,7 @@ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \Re
153153
}
154154

155155
if (!$bundleConfig['dir']) {
156-
if (\in_array($bundleConfig['type'], array('annotation', 'staticphp'))) {
156+
if (\in_array($bundleConfig['type'], ['annotation', 'staticphp'])) {
157157
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName();
158158
} else {
159159
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory();
@@ -197,25 +197,25 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont
197197
}
198198
$mappingDriverDef->setArguments($args);
199199
} elseif ('annotation' == $driverType) {
200-
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
200+
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
201201
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
202202
array_values($driverPaths),
203-
));
203+
]);
204204
} else {
205-
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
205+
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
206206
array_values($driverPaths),
207-
));
207+
]);
208208
}
209209
$mappingDriverDef->setPublic(false);
210210
if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) {
211-
$mappingDriverDef->setArguments(array(array_flip($driverPaths)));
212-
$mappingDriverDef->addMethodCall('setGlobalBasename', array('mapping'));
211+
$mappingDriverDef->setArguments([array_flip($driverPaths)]);
212+
$mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']);
213213
}
214214

215215
$container->setDefinition($mappingService, $mappingDriverDef);
216216

217217
foreach ($driverPaths as $prefix => $driverPath) {
218-
$chainDriverDef->addMethodCall('addDriver', array(new Reference($mappingService), $prefix));
218+
$chainDriverDef->addMethodCall('addDriver', [new Reference($mappingService), $prefix]);
219219
}
220220
}
221221

@@ -240,7 +240,7 @@ protected function assertValidMappingConfiguration(array $mappingConfig, $object
240240
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
241241
}
242242

243-
if (!\in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
243+
if (!\in_array($mappingConfig['type'], ['xml', 'yml', 'annotation', 'php', 'staticphp'])) {
244244
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
245245
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
246246
'You can register them by adding a new driver to the '.
@@ -340,11 +340,11 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
340340
$cacheDef = new Definition($memcachedClass);
341341
$memcachedInstance = new Definition($memcachedInstanceClass);
342342
$memcachedInstance->setPrivate(true);
343-
$memcachedInstance->addMethodCall('addServer', array(
343+
$memcachedInstance->addMethodCall('addServer', [
344344
$memcachedHost, $memcachedPort,
345-
));
345+
]);
346346
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)), $memcachedInstance);
347-
$cacheDef->addMethodCall('setMemcached', array(new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)))));
347+
$cacheDef->addMethodCall('setMemcached', [new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)))]);
348348
break;
349349
case 'redis':
350350
$redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%';
@@ -354,11 +354,11 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
354354
$cacheDef = new Definition($redisClass);
355355
$redisInstance = new Definition($redisInstanceClass);
356356
$redisInstance->setPrivate(true);
357-
$redisInstance->addMethodCall('connect', array(
357+
$redisInstance->addMethodCall('connect', [
358358
$redisHost, $redisPort,
359-
));
359+
]);
360360
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)), $redisInstance);
361-
$cacheDef->addMethodCall('setRedis', array(new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)))));
361+
$cacheDef->addMethodCall('setRedis', [new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)))]);
362362
break;
363363
case 'apc':
364364
case 'apcu':
@@ -387,7 +387,7 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
387387
$cacheDriver['namespace'] = $namespace;
388388
}
389389

390-
$cacheDef->addMethodCall('setNamespace', array($cacheDriver['namespace']));
390+
$cacheDef->addMethodCall('setNamespace', [$cacheDriver['namespace']]);
391391

392392
$container->setDefinition($cacheDriverServiceId, $cacheDef);
393393

@@ -410,10 +410,10 @@ protected function fixManagersAutoMappings(array $managerConfigs, array $bundles
410410
continue 2;
411411
}
412412
}
413-
$managerConfigs[$autoMappedManager]['mappings'][$bundle] = array(
413+
$managerConfigs[$autoMappedManager]['mappings'][$bundle] = [
414414
'mapping' => true,
415415
'is_bundle' => true,
416-
);
416+
];
417417
}
418418
$managerConfigs[$autoMappedManager]['auto_mapping'] = false;
419419
}

‎src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ private function addTaggedSubscribers(ContainerBuilder $container)
6565

6666
foreach ($taggedSubscribers as $taggedSubscriber) {
6767
list($id, $tag) = $taggedSubscriber;
68-
$connections = isset($tag['connection']) ? array($tag['connection']) : array_keys($this->connections);
68+
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
6969
foreach ($connections as $con) {
7070
if (!isset($this->connections[$con])) {
7171
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
7272
}
7373

74-
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', array(new Reference($id)));
74+
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]);
7575
}
7676
}
7777
}
@@ -88,7 +88,7 @@ private function addTaggedListeners(ContainerBuilder $container)
8888
throw new InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
8989
}
9090

91-
$connections = isset($tag['connection']) ? array($tag['connection']) : array_keys($this->connections);
91+
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
9292
foreach ($connections as $con) {
9393
if (!isset($this->connections[$con])) {
9494
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
@@ -130,12 +130,12 @@ private function getEventManagerDef(ContainerBuilder $container, $name)
130130
*/
131131
private function findAndSortTags($tagName, ContainerBuilder $container)
132132
{
133-
$sortedTags = array();
133+
$sortedTags = [];
134134

135135
foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $tags) {
136136
foreach ($tags as $attributes) {
137137
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
138-
$sortedTags[$priority][] = array($serviceId, $attributes);
138+
$sortedTags[$priority][] = [$serviceId, $attributes];
139139
}
140140
}
141141

‎src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function process(ContainerBuilder $container)
146146
// Definition for a Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain
147147
$chainDriverDef = $container->getDefinition($chainDriverDefService);
148148
foreach ($this->namespaces as $namespace) {
149-
$chainDriverDef->addMethodCall('addDriver', array($mappingDriverDef, $namespace));
149+
$chainDriverDef->addMethodCall('addDriver', [$mappingDriverDef, $namespace]);
150150
}
151151

152152
if (!\count($this->aliasMap)) {
@@ -157,7 +157,7 @@ public function process(ContainerBuilder $container)
157157
// Definition of the Doctrine\...\Configuration class specific to the Doctrine flavour.
158158
$configurationServiceDefinition = $container->getDefinition($configurationServiceName);
159159
foreach ($this->aliasMap as $alias => $namespace) {
160-
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName, array($alias, $namespace));
160+
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName, [$alias, $namespace]);
161161
}
162162
}
163163

‎src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
2626
{
2727
protected $registry;
2828

29-
private $cache = array();
29+
private $cache = [];
3030

3131
public function __construct(ManagerRegistry $registry)
3232
{
@@ -39,7 +39,7 @@ public function __construct(ManagerRegistry $registry)
3939
public function guessType($class, $property)
4040
{
4141
if (!$ret = $this->getMetadata($class)) {
42-
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', array(), Guess::LOW_CONFIDENCE);
42+
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE);
4343
}
4444

4545
list($metadata, $name) = $ret;
@@ -133,7 +133,7 @@ public function guessMaxLength($class, $property)
133133
return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
134134
}
135135

136-
if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
136+
if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
137137
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
138138
}
139139
}
@@ -146,7 +146,7 @@ public function guessPattern($class, $property)
146146
{
147147
$ret = $this->getMetadata($class);
148148
if ($ret && isset($ret[0]->fieldMappings[$property]) && !$ret[0]->hasAssociation($property)) {
149-
if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
149+
if (\in_array($ret[0]->getTypeOfField($property), [Type::DECIMAL, Type::FLOAT])) {
150150
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
151151
}
152152
}
@@ -164,7 +164,7 @@ protected function getMetadata($class)
164164
$this->cache[$class] = null;
165165
foreach ($this->registry->getManagers() as $name => $em) {
166166
try {
167-
return $this->cache[$class] = array($em->getClassMetadata($class), $name);
167+
return $this->cache[$class] = [$em->getClassMetadata($class), $name];
168168
} catch (MappingException $e) {
169169
// not an entity or mapped super class
170170
} catch (LegacyMappingException $e) {

‎src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function configureOptions(OptionsResolver $resolver)
4040
};
4141

4242
$resolver->setNormalizer('query_builder', $queryBuilderNormalizer);
43-
$resolver->setAllowedTypes('query_builder', array('null', 'callable', 'Doctrine\ORM\QueryBuilder'));
43+
$resolver->setAllowedTypes('query_builder', ['null', 'callable', 'Doctrine\ORM\QueryBuilder']);
4444
}
4545

4646
/**
@@ -78,10 +78,10 @@ public function getBlockPrefix()
7878
*/
7979
public function getQueryBuilderPartsForCachingHash($queryBuilder)
8080
{
81-
return array(
81+
return [
8282
$queryBuilder->getQuery()->getSQL(),
83-
array_map(array($this, 'parameterToArray'), $queryBuilder->getParameters()->toArray()),
84-
);
83+
array_map([$this, 'parameterToArray'], $queryBuilder->getParameters()->toArray()),
84+
];
8585
}
8686

8787
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.