Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit33a001e

Browse files
committed
switched array() to []
1 parentc7f46e4 commit33a001e

File tree

2,234 files changed

+32060
-32060
lines changed

Some content is hidden

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

2,234 files changed

+32060
-32060
lines changed

‎.php_cs.dist‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ if (!file_exists(__DIR__.'/src')) {
55
}
66

77
returnPhpCsFixer\Config::create()
8-
->setRules(array(
8+
->setRules([
99
'@Symfony' =>true,
1010
'@Symfony:risky' =>true,
1111
'@PHPUnit48Migration:risky' =>true,
1212
'php_unit_no_expectation_annotation' =>false,// part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
13-
'array_syntax' =>array('syntax' =>'short'),
13+
'array_syntax' =>['syntax' =>'short'],
1414
'fopen_flags' =>false,
1515
'ordered_imports' =>true,
1616
'protected_to_private' =>false,
1717
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
18-
'native_function_invocation' =>array('include' =>array('@compiler_optimized'),'scope' =>'namespaced'),
18+
'native_function_invocation' =>['include' =>['@compiler_optimized'],'scope' =>'namespaced'],
1919
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
20-
'phpdoc_types_order' =>array('null_adjustment' =>'always_last','sort_algorithm' =>'none'),
21-
))
20+
'phpdoc_types_order' =>['null_adjustment' =>'always_last','sort_algorithm' =>'none'],
21+
])
2222
->setRiskyAllowed(true)
2323
->setFinder(
2424
PhpCsFixer\Finder::create()
2525
->in(__DIR__.'/src')
26-
->append(array(__FILE__))
27-
->exclude(array(
26+
->append([__FILE__])
27+
->exclude([
2828
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
2929
'Symfony/Component/DependencyInjection/Tests/Fixtures',
3030
'Symfony/Component/Routing/Tests/Fixtures/dumper',
@@ -38,7 +38,7 @@ return PhpCsFixer\Config::create()
3838
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
3939
// explicit trigger_error tests
4040
'Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/',
41-
))
41+
])
4242
// Support for older PHPunit version
4343
->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php')
4444
// file content autogenerated by `var_export`

‎src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class ContainerAwareEventManager extends EventManager
2727
*
2828
* <event> => <listeners>
2929
*/
30-
private$listeners =array();
31-
private$initialized =array();
30+
private$listeners =[];
31+
private$initialized =[];
3232
private$container;
3333

3434
publicfunction__construct(ContainerInterface$container)

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

Lines changed: 14 additions & 14 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
publicfunction__construct(ManagerRegistry$registry)
3939
{
@@ -58,24 +58,24 @@ public function addLogger($name, DebugStack $logger)
5858
*/
5959
publicfunctioncollect(Request$request,Response$response,\Exception$exception =null)
6060
{
61-
$queries =array();
61+
$queries =[];
6262
foreach ($this->loggersas$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
publicfunctionreset()
7474
{
75-
$this->data =array();
75+
$this->data =[];
7676

7777
foreach ($this->loggersas$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])) {
@@ -184,26 +184,26 @@ private function sanitizeParam($var)
184184
$className =\get_class($var);
185185

186186
returnmethod_exists($var,'__toString') ?
187-
array(sprintf('Object(%s): "%s"',$className,$var->__toString()),false) :
188-
array(sprintf('Object(%s)',$className),false);
187+
[sprintf('Object(%s): "%s"',$className,$var->__toString()),false] :
188+
[sprintf('Object(%s)',$className),false];
189189
}
190190

191191
if (\is_array($var)) {
192-
$a =array();
192+
$a =[];
193193
$original =true;
194194
foreach ($varas$k =>$v) {
195195
list($value,$orig) =$this->sanitizeParam($v);
196196
$original =$original &&$orig;
197197
$a[$k] =$value;
198198
}
199199

200-
returnarray($a,$original);
200+
return[$a,$original];
201201
}
202202

203203
if (\is_resource($var)) {
204-
returnarray(sprintf('Resource(%s)',get_resource_type($var)),false);
204+
return[sprintf('Resource(%s)',get_resource_type($var)),false];
205205
}
206206

207-
returnarray($var,true);
207+
return[$var,true];
208208
}
209209
}

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

Lines changed: 27 additions & 27 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 =newDefinition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'),array(
200+
$mappingDriverDef =newDefinition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'),[
201201
newReference($this->getObjectManagerElementName('metadata.annotation_reader')),
202202
array_values($driverPaths),
203-
));
203+
]);
204204
}else {
205-
$mappingDriverDef =newDefinition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'),array(
205+
$mappingDriverDef =newDefinition('%'.$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 ($driverPathsas$prefix =>$driverPath) {
218-
$chainDriverDef->addMethodCall('addDriver',array(newReference($mappingService),$prefix));
218+
$chainDriverDef->addMethodCall('addDriver',[newReference($mappingService),$prefix]);
219219
}
220220
}
221221

@@ -240,7 +240,7 @@ protected function assertValidMappingConfiguration(array $mappingConfig, $object
240240
thrownew \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
thrownew \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'.
@@ -326,11 +326,11 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
326326
$cacheDef =newDefinition($memcacheClass);
327327
$memcacheInstance =newDefinition($memcacheInstanceClass);
328328
$memcacheInstance->setPrivate(true);
329-
$memcacheInstance->addMethodCall('connect',array(
329+
$memcacheInstance->addMethodCall('connect',[
330330
$memcacheHost,$memcachePort,
331-
));
331+
]);
332332
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcache_instance',$objectManagerName)),$memcacheInstance);
333-
$cacheDef->addMethodCall('setMemcache',array(newReference($this->getObjectManagerElementName(sprintf('%s_memcache_instance',$objectManagerName)))));
333+
$cacheDef->addMethodCall('setMemcache',[newReference($this->getObjectManagerElementName(sprintf('%s_memcache_instance',$objectManagerName)))]);
334334
break;
335335
case'memcached':
336336
$memcachedClass = !empty($cacheDriver['class']) ?$cacheDriver['class'] :'%'.$this->getObjectManagerElementName('cache.memcached.class').'%';
@@ -340,11 +340,11 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
340340
$cacheDef =newDefinition($memcachedClass);
341341
$memcachedInstance =newDefinition($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(newReference($this->getObjectManagerElementName(sprintf('%s_memcached_instance',$objectManagerName)))));
347+
$cacheDef->addMethodCall('setMemcached',[newReference($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 =newDefinition($redisClass);
355355
$redisInstance =newDefinition($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(newReference($this->getObjectManagerElementName(sprintf('%s_redis_instance',$objectManagerName)))));
361+
$cacheDef->addMethodCall('setRedis',[newReference($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
continue2;
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‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ private function addTaggedSubscribers(ContainerBuilder $container)
6565

6666
foreach ($taggedSubscribersas$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 ($connectionsas$con) {
7070
if (!isset($this->connections[$con])) {
7171
thrownewRuntimeException(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(newReference($id)));
74+
$this->getEventManagerDef($container,$con)->addMethodCall('addEventSubscriber',[newReference($id)]);
7575
}
7676
}
7777
}
@@ -88,7 +88,7 @@ private function addTaggedListeners(ContainerBuilder $container)
8888
thrownewInvalidArgumentException(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 ($connectionsas$con) {
9393
if (!isset($this->connections[$con])) {
9494
thrownewRuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s',$con,$id,implode(',',array_keys($this->connections))));
@@ -99,7 +99,7 @@ private function addTaggedListeners(ContainerBuilder $container)
9999
}
100100

101101
// we add one call per event per service so we have the correct order
102-
$this->getEventManagerDef($container,$con)->addMethodCall('addEventListener',array(array($tag['event']),$lazy ?$id :newReference($id)));
102+
$this->getEventManagerDef($container,$con)->addMethodCall('addEventListener',[[$tag['event']],$lazy ?$id :newReference($id)]);
103103
}
104104
}
105105
}
@@ -130,12 +130,12 @@ private function getEventManagerDef(ContainerBuilder $container, $name)
130130
*/
131131
privatefunctionfindAndSortTags($tagName,ContainerBuilder$container)
132132
{
133-
$sortedTags =array();
133+
$sortedTags =[];
134134

135135
foreach ($container->findTaggedServiceIds($tagName,true)as$serviceId =>$tags) {
136136
foreach ($tagsas$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‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
117117
* register alias
118118
* @param string[] $aliasMap Map of alias to namespace
119119
*/
120-
publicfunction__construct($driver,array$namespaces,array$managerParameters,$driverPattern,$enabledParameter =false,$configurationPattern ='',$registerAliasMethodName ='',array$aliasMap =array())
120+
publicfunction__construct($driver,array$namespaces,array$managerParameters,$driverPattern,$enabledParameter =false,$configurationPattern ='',$registerAliasMethodName ='',array$aliasMap =[])
121121
{
122122
$this->driver =$driver;
123123
$this->namespaces =$namespaces;
@@ -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->namespacesas$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->aliasMapas$alias =>$namespace) {
160-
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName,array($alias,$namespace));
160+
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName,[$alias,$namespace]);
161161
}
162162
}
163163

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp