Skip to content

Commit 50c46ab

Browse files
committed
fixed CS
1 parent 90b2bd3 commit 50c46ab

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public function submit(Form $form, array $values = []/*, array $serverParameters
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
/**
@@ -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
}

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;
@@ -136,7 +136,7 @@ public static function fromString($cookie, $url = null)
136136

137137
list($name, $value) = explode('=', array_shift($parts), 2);
138138

139-
$values = array(
139+
$values = [
140140
'name' => trim($name),
141141
'value' => trim($value),
142142
'expires' => null,
@@ -146,7 +146,7 @@ public static function fromString($cookie, $url = null)
146146
'httponly' => false,
147147
'passedRawValue' => true,
148148
'samesite' => null,
149-
);
149+
];
150150

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

Tests/ClientTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,12 @@ public function testSubmitForm()
375375
$client->setNextResponse(new Response('<html><form name="signup" action="/foo"><input type="text" name="username" value="the username" /><input type="password" name="password" value="the password" /><input type="submit" value="Register" /></form></html>'));
376376
$client->request('GET', 'http://www.example.com/foo/foobar');
377377

378-
$client->submitForm('Register', array(
378+
$client->submitForm('Register', [
379379
'username' => 'new username',
380380
'password' => 'new password',
381-
), 'PUT', array(
381+
], 'PUT', [
382382
'HTTP_USER_AGENT' => 'Symfony User Agent',
383-
));
383+
]);
384384

385385
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submitForm() submit forms');
386386
$this->assertEquals('PUT', $client->getRequest()->getMethod(), '->submitForm() allows to change the method');
@@ -396,10 +396,10 @@ public function testSubmitFormNotFound()
396396
$client->request('GET', 'http://www.example.com/foo/foobar');
397397

398398
try {
399-
$client->submitForm('Register', array(
399+
$client->submitForm('Register', [
400400
'username' => 'username',
401401
'password' => 'password',
402-
), 'POST');
402+
], 'POST');
403403
$this->fail('->submitForm() throws a \InvalidArgumentException if the form could not be found');
404404
} catch (\Exception $e) {
405405
$this->assertInstanceOf('InvalidArgumentException', $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found');
@@ -670,23 +670,23 @@ public function testFollowMetaRefresh(string $content, string $expectedEndingUrl
670670

671671
public function getTestsForMetaRefresh()
672672
{
673-
return array(
674-
array('<html><head><meta http-equiv="Refresh" content="4" /><meta http-equiv="refresh" content="0; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'),
675-
array('<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'),
676-
array('<html><head><meta http-equiv="refresh" content="0;URL=\'http://www.example.com/redirected\'"/></head></html>', 'http://www.example.com/redirected'),
677-
array('<html><head><meta http-equiv="refresh" content=\'0;URL="http://www.example.com/redirected"\'/></head></html>', 'http://www.example.com/redirected'),
678-
array('<html><head><meta http-equiv="refresh" content="0; URL = http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'),
679-
array('<html><head><meta http-equiv="refresh" content="0;URL= http://www.example.com/redirected "/></head></html>', 'http://www.example.com/redirected'),
680-
array('<html><head><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected "/></head></html>', 'http://www.example.com/redirected'),
681-
array('<html><head><noscript><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></noscript></head></head></html>', 'http://www.example.com/redirected'),
673+
return [
674+
['<html><head><meta http-equiv="Refresh" content="4" /><meta http-equiv="refresh" content="0; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'],
675+
['<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'],
676+
['<html><head><meta http-equiv="refresh" content="0;URL=\'http://www.example.com/redirected\'"/></head></html>', 'http://www.example.com/redirected'],
677+
['<html><head><meta http-equiv="refresh" content=\'0;URL="http://www.example.com/redirected"\'/></head></html>', 'http://www.example.com/redirected'],
678+
['<html><head><meta http-equiv="refresh" content="0; URL = http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'],
679+
['<html><head><meta http-equiv="refresh" content="0;URL= http://www.example.com/redirected "/></head></html>', 'http://www.example.com/redirected'],
680+
['<html><head><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected "/></head></html>', 'http://www.example.com/redirected'],
681+
['<html><head><noscript><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></noscript></head></head></html>', 'http://www.example.com/redirected'],
682682
// Non-zero timeout should not result in a redirect.
683-
array('<html><head><meta http-equiv="refresh" content="4; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/foo/foobar'),
684-
array('<html><body></body></html>', 'http://www.example.com/foo/foobar'),
683+
['<html><head><meta http-equiv="refresh" content="4; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/foo/foobar'],
684+
['<html><body></body></html>', 'http://www.example.com/foo/foobar'],
685685
// Invalid meta tag placement should not result in a redirect.
686-
array('<html><body><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected"/></body></html>', 'http://www.example.com/foo/foobar'),
686+
['<html><body><meta http-equiv="refresh" content="0;url=http://www.example.com/redirected"/></body></html>', 'http://www.example.com/foo/foobar'],
687687
// Valid meta refresh should not be followed if disabled.
688-
array('<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/foo/foobar', false),
689-
);
688+
['<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/foo/foobar', false],
689+
];
690690
}
691691

692692
public function testBack()
@@ -927,7 +927,7 @@ protected function doRequest($request)
927927
return $response;
928928
}
929929

930-
public function submit(DomCrawlerForm $form, array $values = array())
930+
public function submit(DomCrawlerForm $form, array $values = [])
931931
{
932932
return parent::submit($form, $values);
933933
}

0 commit comments

Comments
 (0)