8000 fixed CS · symfony/symfony@5aa0967 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5aa0967

Browse files
committed
fixed CS
1 parent 18b9e45 commit 5aa0967

File tree

5 files changed

+42
-42
lines changed

5 files changed

+42
-42
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ public function clickLink(string $linkText): Crawler
313313
*
314314
* @return Crawler
315315
*/
316-
public function submit(Form $form, array $values = []/*, array $serverParameters = array()*/)
316+
public function submit(Form $form, array $values = []/*, array $serverParameters = []*/)
317317
{
318318
if (\func_num_args() < 3 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
319-
@trigger_error(sprintf('The "%s()" method will have a new "array $serverParameters = array()" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
319+
@trigger_error(sprintf('The "%s()" method will have a new "array $serverParameters = []" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
320320
}
321321

322322
$form->setValues($values);
@@ -330,7 +330,7 @@ public function submit(Form $form, array $values = []/*, array $serverParameters
330330
* uses it to submit the given form field values.
331331
*
332332
* @param string $button The text content, id, value or name of the form <button> or <input type="submit">
333-
* @param array $fieldValues Use this syntax: array('my_form[name]' => '...', 'my_form[email]' => '...')
333+
* @param array $fieldValues Use this syntax: ['my_form[name]' => '...', 'my_form[email]' => '...']
334334
* @param string $method The HTTP method used to submit the form
335335
* @param array $serverParameters These values override the ones stored in $_SERVER (HTTP headers must include a HTTP_ prefix as PHP does)
336336
*/

src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class_exists('Test\\'.__NAMESPACE__.'\\UseTraitWithInternalMethod', true);
307307

308308
public function testVirtualUse()
309309
{
310-
$deprecations = array();
310+
$deprecations = [];
311311
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
312312
$e = error_reporting(E_USER_DEPRECATED);
313313

@@ -316,7 +316,7 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsVirtual', true);
316316
error_reporting($e);
317317
restore_error_handler();
318318

319-
$this->assertSame(array(
319+
$this->assertSame([
320320
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::sameLineInterfaceMethodNoBraces()".',
321321
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::newLineInterfaceMethod()": Some description!',
322322
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::newLineInterfaceMethodNoBraces()": Description.',
@@ -328,12 +328,12 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsVirtual', true);
328328
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "static Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::staticMethodTyped(int $arg)": Description.',
329329
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "static Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::staticMethodTypedNoBraces()".',
330330
'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtual" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualSubInterface::subInterfaceMethod()".',
331-
), $deprecations);
331+
], $deprecations);
332332
}
333333

334334
public function testVirtualUseWithMagicCall()
335335
{
336-
$deprecations = array();
336+
$deprecations = [];
337337
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
338338
$e = error_reporting(E_USER_DEPRECATED);
339339

@@ -342,7 +342,7 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsVirtualMagicCall', true);
342342
error_reporting($e);
343343
restore_error_handler();
344344

345-
$this->assertSame(array(), $deprecations);
345+
$this->assertSame([], $deprecations);
346346
}
347347
}
348348

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function dump(array $options = [])
224224
if ($this->addGetService) {
225225
$code = preg_replace(
226226
"/(\r?\n\r?\n public function __construct.+?\\{\r?\n)/s",
227-
"\n private \$getService;$1 \$this->getService = \\Closure::fromCallable(array(\$this, 'getService'));\n",
227+
"\n private \$getService;$1 \$this->getService = \\Closure::fromCallable([\$this, 'getService']);\n",
228228
$code,
229229
1
230230
);
@@ -250,11 +250,11 @@ public function dump(array $options = [])
250250
}
251251
if ($ids = array_keys($ids)) {
252252
sort($ids);
253-
$c = "<?php\n\nreturn array(\n";
253+
$c = "<?php\n\nreturn [\n";
254254
foreach ($ids as $id) {
255255
$c .= ' '.$this->doExport($id)." => true,\n";
256256
}
257-
$files['removed-ids.php'] = $c .= ");\n";
257+
$files['removed-ids.php'] = $c .= "];\n";
258258
}
259259

260260
foreach ($this->generateServiceFiles($services) as $file => $c) {
@@ -293,11 +293,11 @@ public function dump(array $options = [])
293293
\\class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false);
294294
}
295295
296-
return new \\Container{$hash}\\{$options['class']}(array(
296+
return new \\Container{$hash}\\{$options['class']}([
297297
'container.build_hash' => '$hash',
298298
'container.build_id' => '$id',
299299
'container.build_time' => $time,
300-
), __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
300+
], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
301301
< 10000 /code>
302302
EOF;
303303
} else {
@@ -952,7 +952,7 @@ private function startClass(string $class, string $baseClass, string $baseClassW
952952
class $class extends $baseClass
953953
{
954954
private \$parameters;
955-
private \$targetDirs = array();
955+
private \$targetDirs = [];
956956
957957
public function __construct()
958958
{
@@ -970,7 +970,7 @@ public function __construct()
970970
}
971971
if ($this->asFiles) {
972972
$code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code);
973-
$code = str_replace('__construct()', '__construct(array $buildParameters = array(), $containerDir = __DIR__)', $code);
973+
$code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code);
974974
$code .= " \$this->buildParameters = \$buildParameters;\n";
975975
$code .= " \$this->containerDir = \$containerDir;\n";
976976
}
@@ -990,7 +990,7 @@ public function __construct()
990990
if ($this->container->getParameterBag()->all()) {
991991
$code .= " \$this->parameters = \$this->getDefaultParameters();\n\n";
992992
}
993-
$code .= " \$this->services = \$this->privates = array();\n";
993+
$code .= " \$this->services = \$this->privates = [];\n";
994994

995995
$code .= $this->addSyntheticIds();
996996
$code .= $this->addMethodMap();
@@ -1064,7 +1064,7 @@ private function addSyntheticIds(): string
10641064
}
10651065
}
10661066

1067-
return $code ? " \$this->syntheticIds = array(\n{$code} );\n" : '';
1067+
return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : '';
10681068
}
10691069

10701070
private function addRemovedIds(): string
@@ -1091,7 +1091,7 @@ private function addRemovedIds(): string
10911091
$code .= ' '.$this->doExport($id)." => true,\n";
10921092
}
10931093

1094-
$code = "array(\n{$code} )";
1094+
$code = "[\n{$code} ]";
10951095
}
10961096

10971097
return <<<EOF
@@ -1115,7 +1115,7 @@ private function addMethodMap(): string
11151115
}
11161116
}
11171117

1118-
return $code ? " \$this->methodMap = array(\n{$code} );\n" : '';
1118+
return $code ? " \$this->methodMap = [\n{$code} ];\n" : '';
11191119
}
11201120

11211121
private function addFileMap(): string
@@ -1129,16 +1129,16 @@ private function addFileMap(): string
11291129
}
11301130
}
11311131

1132-
return $code ? " \$this->fileMap = array(\n{$code} );\n" : '';
1132+
return $code ? " \$this->fileMap = [\n{$code} ];\n" : '';
11331133
}
11341134

11351135
private function addAliases(): string
11361136
{
11371137
if (!$aliases = $this->container->getAliases()) {
1138-
return "\n \$this->aliases = array();\n";
1138+
return "\n \$this->aliases = [];\n";
11391139
}
11401140

1141-
$code = " \$this->aliases = array(\n";
1141+
$code = " \$this->aliases = [\n";
11421142
ksort($aliases);
11431143
foreach ($aliases as $alias => $id) {
11441144
$id = (string) $id;
@@ -1148,7 +1148,7 @@ private function addAliases(): string
11481148
$code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n";
11491149
}
11501150

1151-
return $code." );\n";
1151+
return $code." ];\n";
11521152
}
11531153

11541154
private function addInlineRequires(): string
@@ -1196,15 +1196,15 @@ private function addDefaultParametersMethod(): string
11961196
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
11971197
}
11981198
$export = $this->exportParameters([$value]);
1199-
$export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2);
1199+
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
12001200

12011201
if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $export[1])) {
12021202
$dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]);
12031203
} else {
12041204
$php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
12051205
}
12061206
}
1207-
$parameters = sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', 8));
1207+
$parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8));
12081208

12091209
$code = <<<'EOF'
12101210
@@ -1274,14 +1274,14 @@ public function getParameterBag()
12741274
EOF;
12751275
$getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp));
12761276
} else {
1277-
$loadedDynamicParameters = 'array()';
1277+
$loadedDynamicParameters = '[]';
12781278
$getDynamicParameter = str_repeat(' ', 8).'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));';
12791279
}
12801280

12811281
$code .= <<<EOF
12821282
12831283
private \$loadedDynamicParameters = {$loadedDynamicParameters};
1284-
private \$dynamicParameters = array();
1284+
private \$dynamicParameters = [];
12851285
12861286
/*{$this->docStar}
12871287
* Computes a dynamic parameter.
@@ -1338,7 +1338,7 @@ private function exportParameters(array $parameters, string $path = '', int $ind
13381338
$php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value);
13391339
}
13401340

1341-
return sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', $indent - 4));
1341+
return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4));
13421342
}
13431343

13441344
private function endClass(): string
@@ -1444,7 +1444,7 @@ private function dumpValue($value, bool $interpolate = true): string
14441444
$code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate));
14451445
}
14461446

1447-
return sprintf('array(%s)', implode(', ', $code));
1447+
return sprintf('[%s]', implode(', ', $code));
14481448
} elseif ($value instanceof ArgumentInterface) {
14491449
$scope = [$this->definitionVariables, $this->referenceVariables];
14501450
$this->definitionVariables = $this->referenceVariables = null;
@@ -1502,7 +1502,7 @@ private function dumpValue($value, bool $interpolate = true): string
15021502
}
15031503
$definition = $this->container->findDefinition($id = (string) $v);
15041504
$load = !($definition->hasErrors() && $e = $definition->getErrors()) ? $this->asFiles && !$this->isHotPath($definition) : reset($e);
1505-
$serviceMap .= sprintf("\n %s => array(%s, %s, %s, %s),",
1505+
$serviceMap .= sprintf("\n %s => [%s, %s, %s, %s],",
15061506
$this->export($k),
15071507
$this->export($definition->isShared() ? ($definition->isPublic() ? 'services' : 'privates') : false),
15081508
$this->export($id),
@@ -1513,7 +1513,7 @@ private function dumpValue($value, bool $interpolate = true): string
15131513
}
15141514
$this->addGetService = true;
15151515

1516-
return sprintf('new \%s($this->getService, array(%s%s))', ServiceLocator::class, $serviceMap, $serviceMap ? "\n " : '');
1516+
return sprintf('new \%s($this->getService, [%s%s])', ServiceLocator::class, $serviceMap, $serviceMap ? "\n " : '');
15171517
}
15181518
} finally {
15191519
list($this->definitionVariables, $this->referenceVariables) = $scope;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
class Symfony_DI_PhpDumper_Test_DefaultParameters extends Container
1818
{
1919
private $parameters;
20-
private $targetDirs = array();
20+
private $targetDirs = [];
2121

2222
public function __construct()
2323
{
2424
$this->parameters = $this->getDefaultParameters();
2525

26-
$this->services = $this->privates = array();
26+
$this->services = $this->privates = [];
2727

28-
$this->aliases = array();
28+
$this->aliases = [];
2929
}
3030

3131
public function compile()
@@ -40,10 +40,10 @@ public function isCompiled()
4040

4141
public function getRemovedIds()
4242
{
43-
return array(
43+
return [
4444
'Psr\\Container\\ContainerInterface' => true,
4545
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
46-
);
46+
];
4747
}
4848

4949
public function getParameter($name)
@@ -85,12 +85,12 @@ public function getParameterBag()
8585
return $this->parameterBag;
8686
}
8787

88-
private $loadedDynamicParameters = array(
88+
private $loadedDynamicParameters = [
8989
'fallback_env' => false,
9090
'hello' => false,
9191
'hello-bar' => false,
92-
);
93-
private $dynamicParameters = array();
92+
];
93+
private $dynamicParameters = [];
9494

9595
/**
9696
* Computes a dynamic parameter.
@@ -121,10 +121,10 @@ private function getDynamicParameter($name)
121121
*/
122122
protected function getDefaultParameters()
123123
{
124-
return array(
124+
return [
125125
'fallback_param' => 'baz',
126126
'env(foobar)' => 'foobaz',
127127
'env(foo)' => '{"foo": "bar"}',
128-
);
128+
];
129129
}
130130
}

src/Symfony/Component/Routing/RouteCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static function compilePattern(Route $route, $pattern, $isHost)
153153
// Find the next static character after the variable that functions as a separator. By default, this separator and '/'
154154
// are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all
155155
// and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are
156-
// the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html'))
156+
// the same that will be matched. Example: new Route('/{page}.{_format}', ['_format' => 'html'])
157157
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
158158
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
159159
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.

0 commit comments

Comments
 (0)
0