Skip to content

Commit 90b2bd3

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: 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 313512c + a3e81b9 commit 90b2bd3

File tree

10 files changed

+163
-163
lines changed

10 files changed

+163
-163
lines changed

Client.php

Lines changed: 13 additions & 13 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 = []*/)
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
}
@@ -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->getStatus(), array(301, 302, 303))) {
602+
if (\in_array($this->internalResponse->getStatus(), [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
}

CookieJar.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class CookieJar
2020
{
21-
protected $cookieJar = array();
21+
protected $cookieJar = [];
2222

2323
public function set(Cookie $cookie)
2424
{
@@ -84,7 +84,7 @@ public function expire($name, $path = '/', $domain = null)
8484
// this should never happen but it allows for a better BC
8585
$domains = array_keys($this->cookieJar);
8686
} else {
87-
$domains = array($domain);
87+
$domains = [$domain];
8888
}
8989

9090
foreach ($domains as $domain) {
@@ -105,7 +105,7 @@ public function expire($name, $path = '/', $domain = null)
105105
*/
106106
public function clear()
107107
{
108-
$this->cookieJar = array();
108+
$this->cookieJar = [];
109109
}
110110

111111
/**
@@ -116,7 +116,7 @@ public function clear()
116116
*/
117117
public function updateFromSetCookie(array $setCookies, $uri = null)
118118
{
119-
$cookies = array();
119+
$cookies = [];
120120

121121
foreach ($setCookies as $cookie) {
122122
foreach (explode(',', $cookie) as $i => $part) {
@@ -157,7 +157,7 @@ public function all()
157157
{
158158
$this->flushExpiredCookies();
159159

160-
$flattenedCookies = array();
160+
$flattenedCookies = [];
161161
foreach ($this->cookieJar as $path) {
162162
foreach ($path as $cookies) {
163163
foreach ($cookies as $cookie) {
@@ -181,8 +181,8 @@ public function allValues($uri, $returnsRawValue = false)
181181
{
182182
$this->flushExpiredCookies();
183183

184-
$parts = array_replace(array('path' => '/'), parse_url($uri));
185-
$cookies = array();
184+
$parts = array_replace(['path' => '/'], parse_url($uri));
185+
$cookies = [];
186186
foreach ($this->cookieJar as $domain => $pathCookies) {
187187
if ($domain) {
188188
$domain = '.'.ltrim($domain, '.');

History.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
*/
1919
class History
2020
{
21-
protected $stack = array();
21+
protected $stack = [];
2222
protected $position = -1;
2323

2424
/**
2525
* Clears the history.
2626
*/
2727
public function clear()
2828
{
29-
$this->stack = array();
29+
$this->stack = [];
3030
$this->position = -1;
3131
}
3232

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Request
3333
* @param array $server An array of server parameters
3434
* @param string $content The raw body data
3535
*/
36-
public function __construct(string $uri, string $method, array $parameters = array(), array $files = array(), array $cookies = array(), array $server = array(), string $content = null)
36+
public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], string $content = null)
3737
{
3838
$this->uri = $uri;
3939
$this->method = $method;

Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Response
2828
* @param int $status The response status code
2929
* @param array $headers An array of headers
3030
*/
31-
public function __construct(string $content = '', int $status = 200, array $headers = array())
31+
public function __construct(string $content = '', int $status = 200, array $headers = [])
3232
{
3333
$this->content = $content;
3434
$this->status = $status;
@@ -116,10 +116,10 @@ public function getHeader($header, $first = true)
116116
return \is_array($value) ? (\count($value) ? $value[0] : '') : $value;
117117
}
118118

119-
return \is_array($value) ? $value : array($value);
119+
return \is_array($value) ? $value : [$value];
120120
}
121121
}
122122

123-
return $first ? null : array();
123+
return $first ? null : [];
124124
}
125125
}

0 commit comments

Comments
 (0)