Skip to content

Commit 884689e

Browse files
committed
switched array() to []
1 parent 6d98fb2 commit 884689e

File tree

11 files changed

+162
-162
lines changed

11 files changed

+162
-162
lines changed

Client.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class Client
3030
{
3131
protected $history;
3232
protected $cookieJar;
33-
protected $server = array();
33+
protected $server = [];
3434
protected $internalRequest;
3535
protected $request;
3636
protected $internalResponse;
@@ -42,15 +42,15 @@ abstract class Client
4242

4343
private $maxRedirects = -1;
4444
private $redirectCount = 0;
45-
private $redirects = array();
45+
private $redirects = [];
4646
private $isMainRequest = true;
4747

4848
/**
4949
* @param array $server The server parameters (equivalent of $_SERVER)
5050
* @param History $history A History instance to store the browser history
5151
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
5252
*/
53-
public function __construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
53+
public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
5454
{
5555
$this->setServerParameters($server);
5656
$this->history = $history ?: new History();
@@ -121,9 +121,9 @@ public function insulate($insulated = true)
121121
*/
122122
public function setServerParameters(array $server)
123123
{
124-
$this->server = array_merge(array(
124+
$this->server = array_merge([
125125
'HTTP_USER_AGENT' => 'Symfony BrowserKit',
126-
), $server);
126+
], $server);
127127
}
128128

129129
/**
@@ -252,7 +252,7 @@ public function click(Link $link)
252252
*
253253
* @return Crawler
254254
*/
255-
public function submit(Form $form, array $values = array())
255+
public function submit(Form $form, array $values = [])
256256
{
257257
$form->setValues($values);
258258

@@ -272,7 +272,7 @@ public function submit(Form $form, array $values = array())
272272
*
273273
* @return Crawler
274274
*/
275-
public function request($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true)
275+
public function request($method, $uri, array $parameters = [], array $files = [], array $server = [], $content = null, $changeHistory = true)
276276
{
277277
if ($this->isMainRequest) {
278278
$this->redirectCount = 0;
@@ -359,7 +359,7 @@ protected function doRequestInProcess($request)
359359
if (file_exists($deprecationsFile)) {
360360
$deprecations = file_get_contents($deprecationsFile);
361361
unlink($deprecationsFile);
362-
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
362+
foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
363363
if ($deprecation[0]) {
364364
@trigger_error($deprecation[1], E_USER_DEPRECATED);
365365
} else {
@@ -503,9 +503,9 @@ public function followRedirect()
503503

504504
$request = $this->internalRequest;
505505

506-
if (\in_array($this->internalResponse->getStatus(), array(301, 302, 303))) {
506+
if (\in_array($this->internalResponse->getStatus(), [301, 302, 303])) {
507507
$method = 'GET';
508-
$files = array();
508+
$files = [];
509509
$content = null;
510510
} else {
511511
$method = $request->getMethod();
@@ -515,7 +515,7 @@ public function followRedirect()
515515

516516
if ('GET' === strtoupper($method)) {
517517
// Don't forward parameters for GET request as it should reach the redirection URI
518-
$parameters = array();
518+
$parameters = [];
519519
} else {
520520
$parameters = $request->getParameters();
521521
}

Cookie.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class Cookie
2222
* Handles dates as defined by RFC 2616 section 3.3.1, and also some other
2323
* non-standard, but common formats.
2424
*/
25-
private static $dateFormats = array(
25+
private static $dateFormats = [
2626
'D, d M Y H:i:s T',
2727
'D, d-M-y H:i:s T',
2828
'D, d-M-Y H:i:s T',
2929
'D, d-m-y H:i:s T',
3030
'D, d-m-Y H:i:s T',
3131
'D M j G:i:s Y',
3232
'D M d H:i:s Y T',
33-
);
33+
];
3434

3535
protected $name;
3636
protected $value;
@@ -129,7 +129,7 @@ public static function fromString($cookie, $url = null)
129129

130130
list($name, $value) = explode('=', array_shift($parts), 2);
131131

132-
$values = array(
132+
$values = [
133133
'name' => trim($name),
134134
'value' => trim($value),
135135
'expires' => null,
@@ -138,7 +138,7 @@ public static function fromString($cookie, $url = null)
138138
'secure' => false,
139139
'httponly' => false,
140140
'passedRawValue' => true,
141-
);
141+
];
142142

143143
if (null !== $url) {
144144
if ((false === $urlParts = parse_url($url)) || !isset($urlParts['host'])) {

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($uri, $method, array $parameters = array(), array $files = array(), array $cookies = array(), array $server = array(), $content = null)
36+
public function __construct($uri, $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], $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($content = '', $status = 200, array $headers = array())
31+
public function __construct($content = '', $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)