@@ -31,7 +31,7 @@ abstract class Client
31
31
{
32
32
protected $ history ;
33
33
protected $ cookieJar ;
34
- protected $ server = array () ;
34
+ protected $ server = [] ;
35
35
protected $ internalRequest ;
36
36
protected $ request ;
37
37
protected $ internalResponse ;
@@ -44,15 +44,15 @@ abstract class Client
44
44
45
45
private $ maxRedirects = -1 ;
46
46
private $ redirectCount = 0 ;
47
- private $ redirects = array () ;
47
+ private $ redirects = [] ;
48
48
private $ isMainRequest = true ;
49
49
50
50
/**
51
51
* @param array $server The server parameters (equivalent of $_SERVER)
52
52
* @param History $history A History instance to store the browser history
53
53
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
54
54
*/
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 )
56
56
{
57
57
$ this ->setServerParameters ($ server );
58
58
$ this ->history = $ history ?: new History ();
@@ -131,9 +131,9 @@ public function insulate($insulated = true)
131
131
*/
132
132
public function setServerParameters (array $ server )
133
133
{
134
- $ this ->server = array_merge (array (
134
+ $ this ->server = array_merge ([
135
135
'HTTP_USER_AGENT ' => 'Symfony BrowserKit ' ,
136
- ) , $ server );
136
+ ] , $ server );
137
137
}
138
138
139
139
/**
@@ -160,7 +160,7 @@ public function getServerParameter($key, $default = '')
160
160
return isset ($ this ->server [$ key ]) ? $ this ->server [$ key ] : $ default ;
161
161
}
162
162
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
164
164
{
165
165
$ this ->setServerParameter ('HTTP_X_REQUESTED_WITH ' , 'XMLHttpRequest ' );
166
166
@@ -313,14 +313,14 @@ public function clickLink(string $linkText): Crawler
313
313
*
314
314
* @return Crawler
315
315
*/
316
- public function submit (Form $ form , array $ values = array () /*, array $serverParameters = array() */ )
316
+ public function submit (Form $ form , array $ values = [] /*, array $serverParameters = [] */ )
317
317
{
318
318
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
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 );
320
320
}
321
321
322
322
$ form ->setValues ($ values );
323
- $ serverParameters = 2 < \func_num_args () ? func_get_arg (2 ) : array () ;
323
+ $ serverParameters = 2 < \func_num_args () ? func_get_arg (2 ) : [] ;
324
324
325
325
return $ this ->request ($ form ->getMethod (), $ form ->getUri (), $ form ->getPhpValues (), $ form ->getPhpFiles (), $ serverParameters );
326
326
}
@@ -359,7 +359,7 @@ public function submitForm(string $button, array $fieldValues = array(), string
359
359
*
360
360
* @return Crawler
361
361
*/
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 )
363
363
{
364
364
if ($ this ->isMainRequest ) {
365
365
$ this ->redirectCount = 0 ;
@@ -455,7 +455,7 @@ protected function doRequestInProcess($request)
455
455
if (file_exists ($ deprecationsFile )) {
456
456
$ deprecations = file_get_contents ($ deprecationsFile );
457
457
unlink ($ deprecationsFile );
458
- foreach ($ deprecations ? unserialize ($ deprecations ) : array () as $ deprecation ) {
458
+ foreach ($ deprecations ? unserialize ($ deprecations ) : [] as $ deprecation ) {
459
459
if ($ deprecation [0 ]) {
460
460
@trigger_error ($ deprecation [1 ], E_USER_DEPRECATED );
461
461
} else {
@@ -599,9 +599,9 @@ public function followRedirect()
599
599
600
600
$ request = $ this ->internalRequest ;
601
601
602
- if (\in_array ($ this ->internalResponse ->getStatus (), array ( 301 , 302 , 303 ) )) {
602
+ if (\in_array ($ this ->internalResponse ->getStatus (), [ 301 , 302 , 303 ] )) {
603
603
$ method = 'GET ' ;
604
- $ files = array () ;
604
+ $ files = [] ;
605
605
$ content = null ;
606
606
} else {
607
607
$ method = $ request ->getMethod ();
@@ -611,7 +611,7 @@ public function followRedirect()
611
611
612
612
if ('GET ' === strtoupper ($ method )) {
613
613
// Don't forward parameters for GET request as it should reach the redirection URI
614
- $ parameters = array () ;
614
+ $ parameters = [] ;
615
615
} else {
616
616
$ parameters = $ request ->getParameters ();
617
617
}
0 commit comments