Skip to content

Commit 8ea35b3

Browse files
committed
Merge branch '4.2' into short-array-master
* 4.2: fixed CS fixed CS fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents f117c68 + 30726a9 commit 8ea35b3

16 files changed

+135
-135
lines changed

Formatter/ConsoleFormatter.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ConsoleFormatter implements FormatterInterface
3030
const SIMPLE_FORMAT = "%datetime% %start_tag%%level_name%%end_tag% <comment>[%channel%]</> %message%%context%%extra%\n";
3131
const SIMPLE_DATE = 'H:i:s';
3232

33-
private static $levelColorMap = array(
33+
private static $levelColorMap = [
3434
Logger::DEBUG => 'fg=white',
3535
Logger::INFO => 'fg=green',
3636
Logger::NOTICE => 'fg=blue',
@@ -39,7 +39,7 @@ class ConsoleFormatter implements FormatterInterface
3939
Logger::CRITICAL => 'fg=red',
4040
Logger::ALERT => 'fg=red',
4141
Logger::EMERGENCY => 'fg=white;bg=red',
42-
);
42+
];
4343

4444
private $options;
4545
private $cloner;
@@ -53,28 +53,28 @@ class ConsoleFormatter implements FormatterInterface
5353
* * colors: If true, the log string contains ANSI code to add color;
5454
* * multiline: If false, "context" and "extra" are dumped on one line.
5555
*/
56-
public function __construct(array $options = array())
56+
public function __construct(array $options = [])
5757
{
58-
$this->options = array_replace(array(
58+
$this->options = array_replace([
5959
'format' => self::SIMPLE_FORMAT,
6060
'date_format' => self::SIMPLE_DATE,
6161
'colors' => true,
6262
'multiline' => false,
6363
'level_name_format' => '%-9s',
6464
'ignore_empty_context_and_extra' => true,
65-
), $options);
65+
], $options);
6666

6767
if (class_exists(VarCloner::class)) {
6868
$this->cloner = new VarCloner();
69-
$this->cloner->addCasters(array(
70-
'*' => array($this, 'castObject'),
71-
));
69+
$this->cloner->addCasters([
70+
'*' => [$this, 'castObject'],
71+
]);
7272

7373
$this->outputBuffer = fopen('php://memory', 'r+b');
7474
if ($this->options['multiline']) {
7575
$output = $this->outputBuffer;
7676
} else {
77-
$output = array($this, 'echoLine');
77+
$output = [$this, 'echoLine'];
7878
}
7979

8080
$this->dumper = new CliDumper($output, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
@@ -114,7 +114,7 @@ public function format(array $record)
114114
$extra = '';
115115
}
116116

117-
$formatted = strtr($this->options['format'], array(
117+
$formatted = strtr($this->options['format'], [
118118
'%datetime%' => $record['datetime']->format($this->options['date_format']),
119119
'%start_tag%' => sprintf('<%s>', $levelColor),
120120
'%level_name%' => sprintf($this->options['level_name_format'], $record['level_name']),
@@ -123,7 +123,7 @@ public function format(array $record)
123123
'%message%' => $this->replacePlaceHolder($record)['message'],
124124
'%context%' => $context,
125125
'%extra%' => $extra,
126-
));
126+
]);
127127

128128
return $formatted;
129129
}
@@ -149,7 +149,7 @@ public function castObject($v, array $a, Stub $s, $isNested)
149149

150150
if ($isNested && !$v instanceof \DateTimeInterface) {
151151
$s->cut = -1;
152-
$a = array();
152+
$a = [];
153153
}
154154

155155
return $a;
@@ -165,7 +165,7 @@ private function replacePlaceHolder(array $record)
165165

166166
$context = $record['context'];
167167

168-
$replacements = array();
168+
$replacements = [];
169169
foreach ($context as $k => $v) {
170170
// Remove quotes added by the dumper around string.
171171
$v = trim($this->dumpData($v, false), '"');

Handler/ChromePhpHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class ChromePhpHandler extends BaseChromePhpHandler
2424
{
25-
private $headers = array();
25+
private $headers = [];
2626

2727
/**
2828
* @var Response
@@ -40,7 +40,7 @@ public function onKernelResponse(FilterResponseEvent $event)
4040

4141
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
4242
$this->sendHeaders = false;
43-
$this->headers = array();
43+
$this->headers = [];
4444

4545
return;
4646
}
@@ -49,7 +49,7 @@ public function onKernelResponse(FilterResponseEvent $event)
4949
foreach ($this->headers as $header => $content) {
5050
$this->response->headers->set($header, $content);
5151
}
52-
$this->headers = array();
52+
$this->headers = [];
5353
}
5454

5555
/**

Handler/ConsoleHandler.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
class ConsoleHandler extends AbstractProcessingHandler implements EventSubscriberInterface
4444
{
4545
private $output;
46-
private $verbosityLevelMap = array(
46+
private $verbosityLevelMap = [
4747
OutputInterface::VERBOSITY_QUIET => Logger::ERROR,
4848
OutputInterface::VERBOSITY_NORMAL => Logger::WARNING,
4949
OutputInterface::VERBOSITY_VERBOSE => Logger::NOTICE,
5050
OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::INFO,
5151
OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG,
52-
);
52+
];
5353

5454
/**
5555
* @param OutputInterface|null $output The console output to use (the handler remains disabled when passing null
@@ -58,7 +58,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
5858
* @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
5959
* level (leave empty to use the default mapping)
6060
*/
61-
public function __construct(OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = array())
61+
public function __construct(OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = [])
6262
{
6363
parent::__construct(Logger::DEBUG, $bubble);
6464
$this->output = $output;
@@ -131,10 +131,10 @@ public function onTerminate(ConsoleTerminateEvent $event)
131131
*/
132132
public static function getSubscribedEvents()
133133
{
134-
return array(
135-
ConsoleEvents::COMMAND => array('onCommand', 255),
136-
ConsoleEvents::TERMINATE => array('onTerminate', -255),
137-
);
134+
return [
135+
ConsoleEvents::COMMAND => ['onCommand', 255],
136+
ConsoleEvents::TERMINATE => ['onTerminate', -255],
137+
];
138138
}
139139

140140
/**
@@ -158,10 +158,10 @@ protected function getDefaultFormatter()
158158
return new ConsoleFormatter();
159159
}
160160

161-
return new ConsoleFormatter(array(
161+
return new ConsoleFormatter([
162162
'colors' => $this->output->isDecorated(),
163163
'multiline' => OutputInterface::VERBOSITY_DEBUG <= $this->output->getVerbosity(),
164-
));
164+
]);
165165
}
166166

167167
/**

Handler/FirePHPHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class FirePHPHandler extends BaseFirePHPHandler
2424
{
25-
private $headers = array();
25+
private $headers = [];
2626

2727
/**
2828
* @var Response
@@ -42,7 +42,7 @@ public function onKernelResponse(FilterResponseEvent $event)
4242
if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $request->headers->get('User-Agent'))
4343
&& !$request->headers->has('X-FirePHP-Version')) {
4444
self::$sendHeaders = false;
45-
$this->headers = array();
45+
$this->headers = [];
4646

4747
return;
4848
}
@@ -51,7 +51,7 @@ public function onKernelResponse(FilterResponseEvent $event)
5151
foreach ($this->headers as $header => $content) {
5252
$this->response->headers->set($header, $content);
5353
}
54-
$this->headers = array();
54+
$this->headers = [];
5555
}
5656

5757
/**

Handler/ServerLogHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ServerLogHandler extends AbstractHandler
2424
private $context;
2525
private $socket;
2626

27-
public function __construct(string $host, int $level = Logger::DEBUG, bool $bubble = true, array $context = array())
27+
public function __construct(string $host, int $level = Logger::DEBUG, bool $bubble = true, array $context = [])
2828
{
2929
parent::__construct($level, $bubble);
3030

@@ -108,7 +108,7 @@ private function formatRecord(array $record)
108108

109109
$recordFormatted = $this->getFormatter()->format($record);
110110

111-
foreach (array('log_uuid', 'uuid', 'uid') as $key) {
111+
foreach (['log_uuid', 'uuid', 'uid'] as $key) {
112112
if (isset($record['extra'][$key])) {
113113
$recordFormatted['log_id'] = $record['extra'][$key];
114114
break;

Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getLogs(/* Request $request = null */)
3636
return $logger->getLogs(...\func_get_args());
3737
}
3838

39-
return array();
39+
return [];
4040
}
4141

4242
/**

Processor/DebugProcessor.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
class DebugProcessor implements DebugLoggerInterface, ResetInterface
2121
{
22-
private $records = array();
23-
private $errorCount = array();
22+
private $records = [];
23+
private $errorCount = [];
2424
private $requestStack;
2525

2626
public function __construct(RequestStack $requestStack = null)
@@ -32,14 +32,14 @@ public function __invoke(array $record)
3232
{
3333
$hash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
3434

35-
$this->records[$hash][] = array(
35+
$this->records[$hash][] = [
3636
'timestamp' => $record['datetime']->getTimestamp(),
3737
'message' => $record['message'],
3838
'priority' => $record['level'],
3939
'priorityName' => $record['level_name'],
4040
'context' => $record['context'],
4141
'channel' => isset($record['channel']) ? $record['channel'] : '',
42-
);
42+
];
4343

4444
if (!isset($this->errorCount[$hash])) {
4545
$this->errorCount[$hash] = 0;
@@ -68,11 +68,11 @@ public function getLogs(/* Request $request = null */)
6868
}
6969

7070
if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) {
71-
return $this->records[spl_object_hash($request)] ?? array();
71+
return $this->records[spl_object_hash($request)] ?? [];
7272
}
7373

7474
if (0 === \count($this->records)) {
75-
return array();
75+
return [];
7676
}
7777

7878
return array_merge(...array_values($this->records));
@@ -101,8 +101,8 @@ public function countErrors(/* Request $request = null */)
101101
*/
102102
public function clear()
103103
{
104-
$this->records = array();
105-
$this->errorCount = array();
104+
$this->records = [];
105+
$this->errorCount = [];
106106
}
107107

108108
/**

Processor/TokenProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function __invoke(array $records)
3131
{
3232
$records['extra']['token'] = null;
3333
if (null !== $token = $this->tokenStorage->getToken()) {
34-
$records['extra']['token'] = array(
34+
$records['extra']['token'] = [
3535
'username' => $token->getUsername(),
3636
'authenticated' => $token->isAuthenticated(),
3737
'roles' => array_map(function ($role) { return $role->getRole(); }, $token->getRoles()),
38-
);
38+
];
3939
}
4040

4141
return $records;

Processor/WebProcessor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
2626
public function __construct(array $extraFields = null)
2727
{
2828
// Pass an empty array as the default null value would access $_SERVER
29-
parent::__construct(array(), $extraFields);
29+
parent::__construct([], $extraFields);
3030
}
3131

3232
public function onKernelRequest(GetResponseEvent $event)
@@ -39,8 +39,8 @@ public function onKernelRequest(GetResponseEvent $event)
3939

4040
public static function getSubscribedEvents()
4141
{
42-
return array(
43-
KernelEvents::REQUEST => array('onKernelRequest', 4096),
44-
);
42+
return [
43+
KernelEvents::REQUEST => ['onKernelRequest', 4096],
44+
];
4545
}
4646
}

0 commit comments

Comments
 (0)