Skip to content

Commit a4440f9

Browse files
chore: (2/2) Replace long with short syntax.
1 parent 96f68fe commit a4440f9

File tree

302 files changed

+2544
-2542
lines changed

Some content is hidden

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

302 files changed

+2544
-2542
lines changed

components/cache/adapters/chain_adapter.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ lifetime as its constructor arguments::
1717

1818
use Symfony\Component\Cache\Adapter\ApcuAdapter;
1919

20-
$cache = new ChainAdapter(array(
20+
$cache = new ChainAdapter([
2121

2222
// The ordered list of adapters used to fetch cached items
2323
array $adapters,
2424

2525
// The max lifetime of items propagated from lower adapters to upper ones
2626
$maxLifetime = 0
27-
));
27+
]);
2828

2929
.. note::
3030

@@ -40,10 +40,10 @@ slowest storage engines, :class:`Symfony\\Component\\Cache\\Adapter\\ApcuAdapter
4040
use Symfony\Component\Cache\Adapter\ChainAdapter;
4141
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
4242

43-
$cache = new ChainAdapter(array(
43+
$cache = new ChainAdapter([
4444
new ApcuAdapter(),
4545
new FilesystemAdapter(),
46-
));
46+
]);
4747

4848
When calling this adapter's :method:`Symfony\\Component\\Cache\\ChainAdapter::prune` method,
4949
the call is delegated to all its compatible cache adapters. It is safe to mix both adapters
@@ -54,10 +54,10 @@ incompatible adapters are silently ignored::
5454
use Symfony\Component\Cache\Adapter\ChainAdapter;
5555
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
5656

57-
$cache = new ChainAdapter(array(
57+
$cache = new ChainAdapter([
5858
new ApcuAdapter(), // does NOT implement PruneableInterface
5959
new FilesystemAdapter(), // DOES implement PruneableInterface
60-
));
60+
]);
6161

6262
// prune will proxy the call to FilesystemAdapter while silently skipping ApcuAdapter
6363
$cache->prune();

components/cache/adapters/memcached_adapter.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ helper method allows creating and configuring a `Memcached`_ class instance usin
6161
);
6262

6363
// pass an array of DSN strings to register multiple servers with the client
64-
$client = MemcachedAdapter::createConnection(array(
64+
$client = MemcachedAdapter::createConnection([
6565
'memcached://10.0.0.100',
6666
'memcached://10.0.0.101',
6767
'memcached://10.0.0.102',
6868
// etc...
69-
));
69+
]);
7070

7171
.. versionadded:: 3.4
7272

@@ -90,7 +90,7 @@ Below are common examples of valid DSNs showing a combination of available value
9090

9191
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
9292

93-
$client = MemcachedAdapter::createConnection(array(
93+
$client = MemcachedAdapter::createConnection([
9494
// hostname + port
9595
'memcached://my.server.com:11211'
9696

@@ -105,7 +105,7 @@ Below are common examples of valid DSNs showing a combination of available value
105105

106106
// socket instead of hostname/IP + weight
107107
'memcached:///var/run/memcached.sock?weight=20'
108-
));
108+
]);
109109

110110
Configure the Options
111111
---------------------
@@ -122,11 +122,11 @@ option names and their respective values::
122122
[],
123123

124124
// associative array of configuration options
125-
array(
125+
[
126126
'compression' => true,
127127
'libketama_compatible' => true,
128128
'serializer' => 'igbinary',
129-
)
129+
]
130130
);
131131

132132
Available Options

components/cache/adapters/php_array_cache_adapter.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ that is optimized and preloaded into OPcache memory storage::
1414
// somehow, decide it's time to warm up the cache!
1515
if ($needsWarmup) {
1616
// some static values
17-
$values = array(
17+
$values = [
1818
'stats.products_count' => 4711,
1919
'stats.users_count' => 1356,
20-
);
20+
];
2121

2222
$cache = new PhpArrayAdapter(
2323
// single file where values are cached

components/cache/adapters/php_files_adapter.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ Php Files Cache Adapter
1010
Similarly to :ref:`Filesystem Adapter <component-cache-filesystem-adapter>`, this cache
1111
implementation writes cache entries out to disk, but unlike the Filesystem cache adapter,
1212
the PHP Files cache adapter writes and reads back these cache files *as native PHP code*.
13-
For example, caching the value ``array('my', 'cached', 'array')`` will write out a cache
13+
For example, caching the value ``['my', 'cached', 'array']`` will write out a cache
1414
file similar to the following::
1515

16-
<?php return array(
16+
<?php return [
1717

1818
// the cache item expiration
1919
0 => 9223372036854775807,
2020

2121
// the cache item contents
22-
1 => array (
22+
1 => [
2323
0 => 'my',
2424
1 => 'cached',
2525
2 => 'array',
26-
),
26+
],
2727

28-
);
28+
];
2929

3030
.. note::
3131

components/cache/adapters/redis_adapter.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ array of ``key => value`` pairs representing option names and their respective v
9595
'redis://localhost:6379',
9696

9797
// associative array of configuration options
98-
array(
98+
[
9999
'lazy' => false,
100100
'persistent' => 0,
101101
'persistent_id' => null,
102102
'timeout' => 30,
103103
'read_timeout' => 0,
104104
'retry_interval' => 0,
105-
)
105+
]
106106

107107
);
108108

components/cache/cache_invalidation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ cache items, as returned by cache adapters::
3636
// ...
3737
// add one or more tags
3838
$item->tag('tag_1');
39-
$item->tag(array('tag_2', 'tag_3'));
39+
$item->tag(['tag_2', 'tag_3'[);
4040
$cache->save($item);
4141

4242
If ``$cache`` implements :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapterInterface`,
4343
you can invalidate the cached items by calling
4444
:method:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapterInterface::invalidateTags`::
4545

4646
// invalidate all items related to `tag_1` or `tag_3`
47-
$cache->invalidateTags(array('tag_1', 'tag_3'));
47+
$cache->invalidateTags(['tag_1', 'tag_3']);
4848

4949
// if you know the cache key, you can also delete the item directly
5050
$cache->deleteItem('cache_key');

components/cache/cache_items.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ the data stored in the cache item::
4141
$cache->save($productsCount);
4242

4343
// storing an array
44-
$productsCount->set(array(
44+
$productsCount->set([
4545
'category1' => 4711,
4646
'category2' => 2387,
47-
));
47+
]);
4848
$cache->save($productsCount);
4949

5050
The key and the value of any given cache item can be obtained with the

components/cache/cache_pools.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ value but an empty object which implements the :class:`Symfony\\Component\\Cache
5151
class.
5252

5353
If you need to fetch several cache items simultaneously, use instead the
54-
``getItems(array($key1, $key2, ...))`` method::
54+
``getItems([$key1, $key2, ...])`` method::
5555

5656
// ...
57-
$stocks = $cache->getItems(array('AAPL', 'FB', 'GOOGL', 'MSFT'));
57+
$stocks = $cache->getItems(['AAPL', 'FB', 'GOOGL', 'MSFT']);
5858

5959
Again, if any of the keys doesn't represent a valid cache item, you won't get
6060
a ``null`` value but an empty ``CacheItem`` object.
@@ -115,7 +115,7 @@ delete several cache items simultaneously (it returns ``true`` only if all the
115115
items have been deleted, even when any or some of them don't exist)::
116116

117117
// ...
118-
$areDeleted = $cache->deleteItems(array('category1', 'category2'));
118+
$areDeleted = $cache->deleteItems(['category1', 'category2']);
119119

120120
Finally, to remove all the cache items stored in the pool, use the
121121
``Psr\\Cache\\CacheItemPoolInterface::clear`` method (which returns ``true``
@@ -190,13 +190,13 @@ silently ignored)::
190190
use Symfony\Component\Cache\Adapter\PdoAdapter;
191191
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
192192

193-
$cache = new ChainAdapter(array(
193+
$cache = new ChainAdapter([
194194
new ApcuAdapter(), // does NOT implement PruneableInterface
195195
new FilesystemAdapter(), // DOES implement PruneableInterface
196196
new PdoAdapter(), // DOES implement PruneableInterface
197197
new PhpFilesAdapter(), // DOES implement PruneableInterface
198198
// ...
199-
));
199+
]);
200200

201201
// prune will proxy the call to PdoAdapter, FilesystemAdapter and PhpFilesAdapter,
202202
// while silently skipping ApcuAdapter

components/class_loader/class_loader.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,29 @@ your classes::
4141
$loader->addPrefix('Symfony', __DIR__.'/vendor/symfony/symfony/src');
4242

4343
// registers several namespaces at once
44-
$loader->addPrefixes(array(
44+
$loader->addPrefixes([
4545
'Symfony' => __DIR__.'/../vendor/symfony/symfony/src',
4646
'Monolog' => __DIR__.'/../vendor/monolog/monolog/src',
47-
));
47+
]);
4848

4949
// registers a prefix for a class following the PEAR naming conventions
5050
$loader->addPrefix('Twig_', __DIR__.'/vendor/twig/twig/lib');
5151

52-
$loader->addPrefixes(array(
52+
$loader->addPrefixes([
5353
'Swift_' => __DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes',
5454
'Twig_' => __DIR__.'/vendor/twig/twig/lib',
55-
));
55+
]);
5656

5757
Classes from a sub-namespace or a sub-hierarchy of `PEAR`_ classes can be
5858
looked for in a location list to ease the vendoring of a sub-set of classes
5959
for large projects::
6060

61-
$loader->addPrefixes(array(
61+
$loader->addPrefixes([
6262
'Doctrine\Common' => __DIR__.'/vendor/doctrine/common/lib',
6363
'Doctrine\DBAL\Migrations' => __DIR__.'/vendor/doctrine/migrations/lib',
6464
'Doctrine\DBAL' => __DIR__.'/vendor/doctrine/dbal/lib',
6565
'Doctrine' => __DIR__.'/vendor/doctrine/orm/lib',
66-
));
66+
]);
6767

6868
In this example, if you try to use a class in the ``Doctrine\Common`` namespace
6969
or one of its children, the autoloader will first look for the class under

components/class_loader/class_map_generator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ is the same as in the example above)::
119119
use Symfony\Component\ClassLoader\ClassMapGenerator;
120120

121121
ClassMapGenerator::dump(
122-
array(__DIR__.'/library/bar', __DIR__.'/library/foo'),
122+
[__DIR__.'/library/bar', __DIR__.'/library/foo'],
123123
__DIR__.'/class_map.php'
124124
);
125125

0 commit comments

Comments
 (0)