8000 fixed short array CS in comments · symfony/symfony@1429267 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1429267

Browse files
committed
fixed short array CS in comments
1 parent 2524083 commit 1429267

File tree

73 files changed

+264
-264
lines changed

Some content is hidden

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

73 files changed

+264
-264
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
5050
/**
5151
* List of potential container parameters that hold the object manager name
5252
* to register the mappings with the correct metadata driver, for example
53-
* array('acme.manager', 'doctrine.default_entity_manager').
53+
* ['acme.manager', 'doctrine.default_entity_manager'].
5454
*
5555
* @var string[]
5656
*/

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return array();
28+
return [];
2929
}
3030
}
3131
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Test
77
{
88
public static function getGroups()
99
{
10-
return array();
10+
return [];
1111
}
1212
}
1313
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return array();
28+
return [];
2929
}
3030
}
3131
EOPHP

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Test
2525
{
2626
public static function getGroups()
2727
{
28-
return array();
28+
return [];
2929
}
3030
}
3131
EOPHP

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
8383
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
8484
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
8585
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
86-
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));
86+
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", [], $p, getcwd(), null, ['bypass_shell' => true]));
8787
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
8888
if ($exit) {
8989
exit($exit);
@@ -116,9 +116,9 @@ EOPHP
116116
}
117117

118118
global $argv, $argc;
119-
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
119+
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : [];
120120
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
121-
$components = array();
121+
$components = [];
122122
$cmd = array_map('escapeshellarg', $argv);
123123
$exit = 0;
124124

@@ -153,7 +153,7 @@ if ('\\' === DIRECTORY_SEPARATOR) {
153153

154154
if ($components) {
155155
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
156-
$runningProcs = array();
156+
$runningProcs = [];
157157

158158
foreach ($components as $component) {
159159
// Run phpunit tests in parallel
@@ -164,7 +164,7 @@ if ($components) {
164164

165165
$c = escapeshellarg($component);
166166

167-
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) {
167+
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), [], $pipes)) {
168168
$runningProcs[$component] = $proc;
169169
} else {
170170
$exit = 1;
@@ -174,7 +174,7 @@ if ($components) {
174174

175175
while ($runningProcs) {
176176
usleep(300000);
177-
$terminatedProcs = array();
177+
$terminatedProcs = [];
178178
foreach ($runningProcs as $component => $proc) {
179179
$procStatus = proc_get_status($proc);
180180
if (!$procStatus['running']) {
@@ -185,7 +185,7 @@ if ($components) {
185185
}
186186

187187
foreach ($terminatedProcs as $component => $procStatus) {
188-
foreach (array('out', 'err') as $file) {
188+
foreach (['out', 'err'] as $file) {
189189
$file = "$component/phpunit.std$file";
190190
readfile($file);
191191
unlink($file);
@@ -195,7 +195,7 @@ if ($components) {
195195
// STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
196196
// STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
197197
// STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
198-
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) {
198+
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, [-1073740791, -1073741819, -1073740940]))) {
199199
$exit = $procStatus;
200200
echo "\033[41mKO\033[0m $component\n\n";
201201
} else {
@@ -207,7 +207,7 @@ if ($components) {
207207
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
208208
class SymfonyBlacklistSimplePhpunit {}
209209
}
210-
array_splice($argv, 1, 0, array('--colors=always'));
210+
array_splice($argv, 1, 0, ['--colors=always']);
211211
$_SERVER['argv'] = $argv;
212212
$_SERVER['argc'] = ++$argc;
213213
include "$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit";

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getDebug()
150150
* Returns some or all the existing flash messages:
151151
* * getFlashes() returns all the flash messages
152152
* * getFlashes('notice') returns a simple array with flash messages of that type
153-
* * getFlashes(array('notice', 'error')) returns a nested array of type => messages.
153+
* * getFlashes(['notice', 'error']) returns a nested array of type => messages.
154154
*
155155
* @return array
156156
*/

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CHANGELOG
3333
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
3434

3535
// ...
36-
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'));
36+
$rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig']);
3737
$rendererEngine->setEnvironment($twig);
3838
$twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
3939
```
@@ -42,13 +42,13 @@ CHANGELOG
4242

4343
```php
4444
// ...
45-
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
45+
$rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig'], $twig);
4646
// require Twig 1.30+
47-
$twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader(array(
47+
$twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader([
4848
TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) {
4949
return new TwigRenderer($rendererEngine, $csrfTokenManager);
5050
},
51-
)));
51+
]));
5252
$twig->addExtension(new FormExtension());
5353
```
5454
* Deprecated the `TwigRendererEngineInterface` interface.

src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getFunctions()
5151
*
5252
* @param string $uri The relation URI
5353
* @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")
54-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
54+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
5555
*
5656
* @return string The relation URI
5757
*/
@@ -76,7 +76,7 @@ public function link($uri, $rel, array $attributes = [])
7676
* Preloads a resource.
7777
*
7878
* @param string $uri A public path
79-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('crossorigin' => 'use-credentials')")
79+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['crossorigin' => 'use-credentials']")
8080
*
8181
* @return string The path of the asset
8282
*/
@@ -89,7 +89,7 @@ public function preload($uri, array $attributes = [])
8989
* Resolves a resource origin as early as possible.
9090
*
9191
* @param string $uri A public path
92-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
92+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
9393
*
9494
* @return string The path of the asset
9595
*/
@@ -102,7 +102,7 @@ public function dnsPrefetch($uri, array $attributes = [])
102102
* Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
103103
*
104104
* @param string $uri A public path
105-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
105+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
106106
*
107107
* @return string The path of the asset
108108
*/
@@ -115,7 +115,7 @@ public function preconnect($uri, array $attributes = [])
115115
* Indicates to the client that it should prefetch this resource.
116116
*
117117
* @param string $uri A public path
118-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
118+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
119119
*
120120
* @return string The path of the asset
121121
*/
@@ -128,7 +128,7 @@ public function prefetch($uri, array $attributes = [])
128128
* Indicates to the client that it should prerender this resource .
129129
*
130130
* @param string $uri A public path
131-
* @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
131+
* @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
132132
*
133133
* @return string The path of the asset
134134
*/

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ protected function buildContainer()
338338
339339
// filter container's resources, removing reference to temp kernel file
340340
\$resources = \$container->getResources();
341-
\$filteredResources = array();
341+
\$filteredResources = [];
342342
foreach (\$resources as \$resource) {
343343
if ((string) \$resource !== __FILE__) {
344344
\$filteredResources[] = \$resource;

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ abstract protected function configureRoutes(RouteCollectionBuilder $routes);
3939
*
4040
* You can register extensions:
4141
*
42-
* $c->loadFromExtension('framework', array(
42+
* $c->loadFromExtension('framework', [
4343
* 'secret' => '%secret%'
44-
* ));
44+
* ]);
4545
*
4646
* Or services:
4747
*

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function setTheme(FormView $view, $themes, $useDefaultThemes = true)
6161
*
6262
* You can pass options during the call:
6363
*
64-
* <?php echo view['form']->form($form, array('attr' => array('class' => 'foo'))) ?>
64+
* <?php echo view['form']->form($form, ['attr' => ['class' => 'foo']]) ?>
6565
*
66-
* <?php echo view['form']->form($form, array('separator' => '+++++')) ?>
66+
* <?php echo view['form']->form($form, ['separator' => '+++++']) ?>
6767
*
6868
* This method is mainly intended for prototyping purposes. If you want to
6969
* control the layout of a form in a more fine-grained manner, you are
@@ -124,9 +124,9 @@ public function end(FormView $view, array $variables = [])
124124
*
125125
* You can pass options during the call:
126126
*
127-
* <?php echo $view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
127+
* <?php echo $view['form']->widget($form, ['attr' => ['class' => 'foo']]) ?>
128128
*
129-
* <?php echo $view['form']->widget($form, array('separator' => '+++++')) ?>
129+
* <?php echo $view['form']->widget($form, ['separator' => '+++++']) ?>
130130
*
131131
* @param FormView $view The view for which to render the widget
132132
* @param array $variables Additional variables passed to the template

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@
2929
<?php echo $view['translator']->transChoice(
3030
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
3131
10,
32-
array('%count%' => 10)
32+
['%count%' => 10]
3333
) ?>
3434

35-
<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', array(), 'not_messages'); ?>
35+
<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?>
3636

37-
<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?>
37+
<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?>
3838

39-
<?php echo $view['translator']->trans('other-domain-test-params-short-array', array('foo' => 'bar'), 'not_messages'); ?>
39+
<?php echo $view['translator']->trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?>
4040

41-
<?php echo $view['translator']->trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?>
41+
<?php echo $view['translator']->trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?>
4242

43-
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?>
43+
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
4444

45-
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?>
45+
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
4646

47-
<?php echo $view['translator']->trans('typecast', array('a' => (int) '123'), 'not_messages'); ?>
48-
<?php echo $view['translator']->transChoice('msg1', 10 + 1, array(), 'not_messages'); ?>
49-
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), array(), 'not_messages'); ?>
47+
<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
48+
<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
49+
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php if (!$label) { $label = $view['form']->humanize($name); } ?>
2-
<label>Custom name label: <?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain< 10000 /span>)) ?></label>
2+
<label>Custom name label: <?php echo $view->escape($view['translator']->trans($label, [], $translation_domain)) ?></label>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php if (!$label) {
22
$label = $view['form']->humanize($name);
33
} ?>
4-
<label>Custom label: <?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label>
4+
<label>Custom label: <?php echo $view->escape($view['translator']->trans($label, [], $translation_domain)) ?></label>

src/Symfony/Component/Cache/Adapter/PdoAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
3535
* * db_time_col: The column where to store the timestamp [default: item_time]
3636
* * db_username: The username when lazy-connect [default: '']
3737
* * db_password: The password when lazy-connect [default: '']
38-
* * db_connection_options: An array of driver-specific connection options [default: array()]
38+
* * db_connection_options: An array of driver-specific connection options [default: []]
3939
*
4040
* @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
4141
* @param string $namespace

src/Symfony/Component/Cache/Simple/PdoCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PdoCache extends AbstractCache implements PruneableInterface
3333
* * db_time_col: The column where to store the timestamp [default: item_time]
3434
* * db_username: The username when lazy-connect [default: '']
3535
* * db_password: The password when lazy-connect [default: '']
36-
* * db_connection_options: An array of driver-specific connection options [default: array()]
36+
* * db_connection_options: An array of driver-specific connection options [default: []]
3737
*
3838
* @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
3939
* @param string $namespace

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private function init(\Memcached $client, $namespace, $defaultLifetime)
6464
*
6565
* Examples for servers:
6666
* - 'memcached://user:pass@localhost?weight=33'
67-
* - array(array('localhost', 11211, 33))
67+
* - [['localhost', 11211, 33]]
6868
*
6969
* @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs
7070
* @param array $options An array of options

src/Symfony/Component/Cache/Traits/PhpArrayTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function warmUp(array $values)
6060
6161
// This file has been auto-generated by the Symfony Cache Component.
6262
63-
return array(
63+
return [
6464

6565

6666
EOF;
@@ -97,7 +97,7 @@ public function warmUp(array $values)
9797
$dump .= var_export($key, true).' => '.var_export($value, true).",\n";
9898
}
9999

100-
$dump .= "\n);\n";
100+
$dump .= "\n];\n";
101101
$dump = str_replace("' . \"\\0\" . '", "\0", $dump);
102102

103103
$tmpFile = uniqid($this->file, true);

src/Symfony/Component/Config/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The edge case of defining just one value for nodes of type Enum is now allowed:
3434
$rootNode
3535
->children()
3636
->enumNode('variable')
37-
->values(array('value'))
37+
->values(['value'])
3838
->end()
3939
->end()
4040
;

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getChildren()
8282
/**
8383
* Sets the xml remappings that should be performed.
8484
*
85-
* @param array $remappings An array of the form array(array(string, string))
85+
* @param array $remappings An array of the form [[string, string]]
8686
*/
8787
public function setXmlRemappings(array $remappings)
8888
{
@@ -92,7 +92,7 @@ public function setXmlRemappings(array $remappings)
9292
/**
9393
* Gets the xml remappings that should be performed.
9494
*
95-
* @return array an array of the form array(array(string, string))
95+
* @return array an array of the form [[string, string]]
9696
*/
9797
public function getXmlRemappings()
9898
{

src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ public function fixXmlConfig($singular, $plural = null)
214214
* to be the key of the particular item. For example, if "id" is the
215215
* "key", then:
216216
*
217-
* array(
218-
* array('id' => 'my_name', 'foo' => 'bar'),
219-
* );
217+
* [
218+
* ['id' => 'my_name', 'foo' => 'bar'],
219+
* ];
220220
*
221221
* becomes
222222
*
223-
* array(
224-
* 'my_name' => array('foo' => 'bar'),
225-
* );
223+
* [
224+
* 'my_name' => ['foo' => 'bar'],
225+
* ];
226226
*
227227
* If you'd like "'id' => 'my_name'" to still be present in the resulting
228228
* array, then you can set the second argument of this method to false.

0 commit comments

Comments
 (0)
0