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

Skip to content

Commit 18b9e45

Browse files
committed
fixed CS
1 parent 51a359c commit 18b9e45

File tree

48 files changed

+1307
-1307
lines changed

Some content is hidden

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

48 files changed

+1307
-1307
lines changed

src/Symfony/Bridge/PhpUnit/ClassExistsMock.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class ClassExistsMock
1818
{
19-
private static $classes = array();
19+
private static $classes = [];
2020

2121
/**
2222
* Configures the classes to be checked upon existence.
@@ -47,15 +47,15 @@ public static function register($class)
4747
{
4848
$self = \get_called_class();
4949

50-
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
50+
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
5151
if (0 < strpos($class, '\\Tests\\')) {
5252
$ns = str_replace('\\Tests\\', '\\', $class);
5353
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
5454
} elseif (0 === strpos($class, 'Tests\\')) {
5555
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
5656
}
5757
foreach ($mockedNs as $ns) {
58-
foreach (array('class', 'interface', 'trait') as $type) {
58+
foreach (['class', 'interface', 'trait'] as $type) {
5959
if (\function_exists($ns.'\\'.$type.'_exists')) {
6060
continue;
6161
}

src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public static function setUpBeforeClass()
2323

2424
protected function setUp()
2525
{
26-
ClassExistsMock::withMockedClasses(array(
26+
ClassExistsMock::withMockedClasses([
2727
ExistingClass::class => false,
2828
'NonExistingClass' => true,
2929
ExistingInterface::class => false,
3030
'NonExistingInterface' => true,
3131
ExistingTrait::class => false,
3232
'NonExistingTrait' => true,
33-
));
33+
]);
3434
}
3535

3636
public function testClassExists()

src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getConfigTreeBuilder()
6060
->enumNode('theme')
6161
->info('Changes the color of the dump() output when rendered directly on the templating. "dark" (default) or "light"')
6262
->example('dark')
63-
->values(array('dark', 'light'))
63+
->values(['dark', 'light'])
6464
->defaultValue('dark')
6565
->end()
6666
->end()

src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function load(array $configs, ContainerBuilder $container)
4545

4646
if (method_exists(HtmlDumper::class, 'setTheme') && 'dark' !== $config['theme']) {
4747
$container->getDefinition('var_dumper.html_dumper')
48-
->addMethodCall('setTheme', array($config['theme']));
48+
->addMethodCall('setTheme', [$config['theme']]);
4949
}
5050

5151
if (null === $config['dump_destination']) {
@@ -79,9 +79,9 @@ public function load(array $configs, ContainerBuilder $container)
7979

8080
if (method_exists(CliDumper::class, 'setDisplayOptions')) {
8181
$container->getDefinition('var_dumper.cli_dumper')
82-
->addMethodCall('setDisplayOptions', array(array(
82+
->addMethodCall('setDisplayOptions', [[
8383
'fileLinkFormat' => new Reference('debug.file_link_formatter', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE),
84-
)))
84+
]])
8585
;
8686
}
8787
}

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class Client
3131
{
3232
protected $history;
3333
protected $cookieJar;
34-
protected $server = array();
34+
protected $server = [];
3535
protected $internalRequest;
3636
protected $request;
3737
protected $internalResponse;
@@ -44,15 +44,15 @@ abstract class Client
4444

4545
private $maxRedirects = -1;
4646
private $redirectCount = 0;
47-
private $redirects = array();
47+
private $redirects = [];
4848
private $isMainRequest = true;
4949

5050
/**
5151
* @param array $server The server parameters (equivalent of $_SERVER)
5252
* @param History $history A History instance to store the browser history
5353
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
5454
*/
55-
public function __construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
55+
public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
5656
{
5757
$this->setServerParameters($server);
5858
$this->history = $history ?: new History();
@@ -131,9 +131,9 @@ public function insulate($insulated = true)
131131
*/
132132
public function setServerParameters(array $server)
133133
{
134-
$this->server = array_merge(array(
134+
$this->server = array_merge([
135135
'HTTP_USER_AGENT' => 'Symfony BrowserKit',
136-
), $server);
136+
], $server);
137137
}
138138

139139
/**
@@ -160,7 +160,7 @@ public function getServerParameter($key, $default = '')
160160
return isset($this->server[$key]) ? $this->server[$key] : $default;
161161
}
162162

163-
public function xmlHttpRequest(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true): Crawler
163+
public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler
164164
{
165165
$this->setServerParameter('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest');
166166

@@ -313,14 +313,14 @@ public function clickLink(string $linkText): Crawler
313313
*
314314
* @return Crawler
315315
*/
316-
public function submit(Form $form, array $values = array()/*, array $serverParameters = array()*/)
316+
public function submit(Form $form, array $values = []/*, array $serverParameters = array()*/)
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) {
319319
@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);
320320
}
321321

322322
$form->setValues($values);
323-
$serverParameters = 2 < \func_num_args() ? func_get_arg(2) : array();
323+
$serverParameters = 2 < \func_num_args() ? func_get_arg(2) : [];
324324

325325
return $this->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $form->getPhpFiles(), $serverParameters);
326326
}
@@ -334,7 +334,7 @@ public function submit(Form $form, array $values = array()/*, array $serverParam
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
*/
337-
public function submitForm(string $button, array $fieldValues = array(), string $method = 'POST', array $serverParameters = array()): Crawler
337+
public function submitForm(string $button, array $fieldValues = [], string $method = 'POST', array $serverParameters = []): Crawler
338338
{
339339
if (null === $this->crawler) {
340340
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
@@ -343,7 +343,7 @@ public function submitForm(string $button, array $fieldValues = array(), string
343343
$buttonNode = $this->crawler->selectButton($button);
344344
$form = $buttonNode->form($fieldValues, $method);
345345

346-
return $this->submit($form, array(), $serverParameters);
346+
return $this->submit($form, [], $serverParameters);
347347
}
348348

349349
/**
@@ -359,7 +359,7 @@ public function submitForm(string $button, array $fieldValues = array(), string
359359
*
360360
* @return Crawler
361361
*/
362-
public function request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
362+
public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
363363
{
364364
if ($this->isMainRequest) {
365365
$this->redirectCount = 0;
@@ -455,7 +455,7 @@ protected function doRequestInProcess($request)
455455
if (file_exists($deprecationsFile)) {
456456
$deprecations = file_get_contents($deprecationsFile);
457457
unlink($deprecationsFile);
458-
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
458+
foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
459459
if ($deprecation[0]) {
460460
@trigger_error($deprecation[1], E_USER_DEPRECATED);
461461
} else {
@@ -599,9 +599,9 @@ public function followRedirect()
599599

600600
$request = $this->internalRequest;
601601

602-
if (\in_array($this->internalResponse->getStatusCode(), array(301, 302, 303))) {
602+
if (\in_array($this->internalResponse->getStatusCode(), [301, 302, 303])) {
603603
$method = 'GET';
604-
$files = array();
604+
$files = [];
605605
$content = null;
606606
} else {
607607
$method = $request->getMethod();
@@ -611,7 +611,7 @@ public function followRedirect()
611611

612612
if ('GET' === strtoupper($method)) {
613613
// Don't forward parameters for GET request as it should reach the redirection URI
614-
$parameters = array();
614+
$parameters = [];
615615
} else {
616616
$parameters = $request->getParameters();
617617
}
@@ -634,7 +634,7 @@ public function followRedirect()
634634
private function getMetaRefreshUrl(): ?string
635635
{
636636
$metaRefresh = $this->getCrawler()->filter('head meta[http-equiv="refresh"]');
637-
foreach ($metaRefresh->extract(array('content')) as $content) {
637+
foreach ($metaRefresh->extract(['content']) as $content) {
638638
if (preg_match('/^\s*0\s*;\s*URL\s*=\s*(?|\'([^\']++)|"([^"]++)|([^\'"].*))/i', $content, $m)) {
639639
return str_replace("\t\r\n", '', rtrim($m[1]));
640640
}

src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,40 @@
2020
*/
2121
class OutputFormatterStyle implements OutputFormatterStyleInterface
2222
{
23-
private static $availableForegroundColors = array(
24-
'black' => array('set' => 30, 'unset' => 39),
25-
'red' => array('set' => 31, 'unset' => 39),
26-
'green' => array('set' => 32, 'unset' => 39),
27-
'yellow' => array('set' => 33, 'unset' => 39),
28-
'blue' => array('set' => 34, 'unset' => 39),
29-
'magenta' => array('set' => 35, 'unset' => 39),
30-
'cyan' => array('set' => 36, 'unset' => 39),
31-
'white' => array('set' => 37, 'unset' => 39),
32-
'default' => array('set' => 39, 'unset' => 39),
33-
);
34-
private static $availableBackgroundColors = array(
35-
'black' => array('set' => 40, 'unset' => 49),
36-
'red' => array('set' => 41, 'unset' => 49),
37-
'green' => array('set' => 42, 'unset' => 49),
38-
'yellow' => array('set' => 43, 'unset' => 49),
39-
'blue' => array('set' => 44, 'unset' => 49),
40-
'magenta' => array('set' => 45, 'unset' => 49),
41-
'cyan' => array('set' => 46, 'unset' => 49),
42-
'white' => array('set' => 47, 'unset' => 49),
43-
'default' => array('set' => 49, 'unset' => 49),
44-
);
45-
private static $availableOptions = array(
46-
'bold' => array('set' => 1, 'unset' => 22),
47-
'underscore' => array('set' => 4, 'unset' => 24),
48-
'blink' => array('set' => 5, 'unset' => 25),
49-
'reverse' => array('set' => 7, 'unset' => 27),
50-
'conceal' => array('set' => 8, 'unset' => 28),
51-
);
23+
private static $availableForegroundColors = [
24+
'black' => ['set' => 30, 'unset' => 39],
25+
'red' => ['set' => 31, 'unset' => 39],
26+
'green' => ['set' => 32, 'unset' => 39],
27+
'yellow' => ['set' => 33, 'unset' => 39],
28+
'blue' => ['set' => 34, 'unset' => 39],
29+
'magenta' => ['set' => 35, 'unset' => 39],
30+
'cyan' => ['set' => 36, 'unset' => 39],
31+
'white' => ['set' => 37, 'unset' => 39],
32+
'default' => ['set' => 39, 'unset' => 39],
33+
];
34+
private static $availableBackgroundColors = [
35+
'black' => ['set' => 40, 'unset' => 49],
36+
'red' => ['set' => 41, 'unset' => 49],
37+
'green' => ['set' => 42, 'unset' => 49],
38+
'yellow' => ['set' => 43, 'unset' => 49],
39+
'blue' => ['set' => 44, 'unset' => 49],
40+
'magenta' => ['set' => 45, 'unset' => 49],
41+
'cyan' => ['set' => 46, 'unset' => 49],
42+
'white' => ['set' => 47, 'unset' => 49],
43+
'default' => ['set' => 49, 'unset' => 49],
44+
];
45+
private static $availableOptions = [
46+
'bold' => ['set' => 1, 'unset' => 22],
47+
'underscore' => ['set' => 4, 'unset' => 24],
48+
'blink' => ['set' => 5, 'unset' => 25],
49+
'reverse' => ['set' => 7, 'unset' => 27],
50+
'conceal' => ['set' => 8, 'unset' => 28],
51+
];
5252

5353
private $foreground;
5454
private $background;
5555
private $href;
56-
private $options = array();
56+
private $options = [];
5757
private $handlesHrefGracefully;
5858

5959
/**
@@ -63,7 +63,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
6363
* @param string|null $background The style background color name
6464
* @param array $options The style options
6565
*/
66-
public function __construct(string $foreground = null, string $background = null, array $options = array())
66+
public function __construct(string $foreground = null, string $background = null, array $options = [])
6767
{
6868
if (null !== $foreground) {
6969
$this->setForeground($foreground);
@@ -167,7 +167,7 @@ public function unsetOption($option)
167167
*/
168168
public function setOptions(array $options)
169169
{
170-
$this->options = array();
170+
$this->options = [];
171171

172172
foreach ($options as $option) {
173173
$this->setOption($option);
@@ -183,8 +183,8 @@ public function setOptions(array $options)
183183
*/
184184
public function apply($text)
185185
{
186-
$setCodes = array();
187-
$unsetCodes = array();
186+
$setCodes = [];
187+
$unsetCodes = [];
188188

189189
if (null === $this->handlesHrefGracefully) {
190190
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR');

src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ public function testNotDecoratedFormatter(string $input, string $expectedNonDeco
256256

257257
public function provideDecoratedAndNonDecoratedOutput()
258258
{
259-
return array(
260-
array('<error>some error</error>', 'some error', "\033[37;41msome error\033[39;49m"),
261-
array('<info>some info</info>', 'some info', "\033[32msome info\033[39m"),
262-
array('<comment>some comment</comment>', 'some comment', "\033[33msome comment\033[39m"),
263-
array('<question>some question</question>', 'some question', "\033[30;46msome question\033[39;49m"),
264-
array('<fg=red>some text with inline style</>', 'some text with inline style', "\033[31msome text with inline style\033[39m"),
265-
array('<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', "\033]8;;idea://open/?file=/path/SomeFile.php&line=12\033\\some URL\033]8;;\033\\"),
266-
array('<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', 'some URL', 'JetBrains-JediTerm'),
267-
);
259+
return [
260+
['<error>some error</error>', 'some error', "\033[37;41msome error\033[39;49m"],
261+
['<info>some info</info>', 'some info', "\033[32msome info\033[39m"],
262+
['<comment>some comment</comment>', 'some comment', "\033[33msome comment\033[39m"],
263+
['<question>some question</question>', 'some question', "\033[30;46msome question\033[39;49m"],
264+
['<fg=red>some text with inline style</>', 'some text with inline style', "\033[31msome text with inline style\033[39m"],
265+
['<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', "\033]8;;idea://open/?file=/path/SomeFile.php&line=12\033\\some URL\033]8;;\033\\"],
266+
['<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', 'some URL', 'JetBrains-JediTerm'],
267+
];
268268
}
269269

270270
public function testContentWithLineBreaks()

0 commit comments

Comments
 (0)
0