Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7127d15

Browse filesBrowse files
committed
[Validator] Update array creation syntax to meet the new coding standards
1 parent 8bb60ea commit 7127d15
Copy full SHA for 7127d15

14 files changed

+86
-86
lines changed

‎src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testUnknownModesTriggerException()
4545

4646
public function testNormalizerCanBeSet()
4747
{
48-
$email = new Email(array('normalizer' => 'trim'));
48+
$email = new Email(['normalizer' => 'trim']);
4949

5050
$this->assertEquals('trim', $email->normalizer);
5151
}
@@ -56,7 +56,7 @@ public function testNormalizerCanBeSet()
5656
*/
5757
public function testInvalidNormalizerThrowsException()
5858
{
59-
new Email(array('normalizer' => 'Unknown Callable'));
59+
new Email(['normalizer' => 'Unknown Callable']);
6060
}
6161

6262
/**
@@ -65,6 +65,6 @@ public function testInvalidNormalizerThrowsException()
6565
*/
6666
public function testInvalidNormalizerObjectThrowsException()
6767
{
68-
new Email(array('normalizer' => new \stdClass()));
68+
new Email(['normalizer' => new \stdClass()]);
6969
}
7070
}

‎src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ public function getValidEmails()
9999
*/
100100
public function testValidNormalizedEmails($email)
101101
{
102-
$this->validator->validate($email, new Email(array('normalizer' => 'trim')));
102+
$this->validator->validate($email, new Email(['normalizer' => 'trim']));
103103

104104
$this->assertNoViolation();
105105
}
106106

107107
public function getValidEmailsWithWhitespaces()
108108
{
109-
return array(
110-
array("\x20example@example.co.uk\x20"),
111-
array("\x09\x09example@example.co..uk\x09\x09"),
112-
array("\x0A{}~!@!@£$%%^&*().!@£$%^&*()\x0A"),
113-
array("\x0D\x0Dexample@example.co..uk\x0D\x0D"),
114-
array("\x00example@-example.com"),
115-
array("example@example.com\x0B\x0B"),
116-
);
109+
return [
110+
["\x20example@example.co.uk\x20"],
111+
["\x09\x09example@example.co..uk\x09\x09"],
112+
["\x0A{}~!@!@£$%%^&*().!@£$%^&*()\x0A"],
113+
["\x0D\x0Dexample@example.co..uk\x0D\x0D"],
114+
["\x00example@-example.com"],
115+
["example@example.com\x0B\x0B"],
116+
];
117117
}
118118

119119
/**

‎src/Symfony/Component/Validator/Tests/Constraints/IpTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/IpTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class IpTest extends TestCase
2121
{
2222
public function testNormalizerCanBeSet()
2323
{
24-
$ip = new Ip(array('normalizer' => 'trim'));
24+
$ip = new Ip(['normalizer' => 'trim']);
2525

2626
$this->assertEquals('trim', $ip->normalizer);
2727
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
3232
*/
3333
public function testInvalidNormalizerThrowsException()
3434
{
35-
new Ip(array('normalizer' => 'Unknown Callable'));
35+
new Ip(['normalizer' => 'Unknown Callable']);
3636
}
3737

3838
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
4141
*/
4242
public function testInvalidNormalizerObjectThrowsException()
4343
{
44-
new Ip(array('normalizer' => new \stdClass()));
44+
new Ip(['normalizer' => new \stdClass()]);
4545
}
4646
}

‎src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@ public function getValidIpsV4()
8585
*/
8686
public function testValidIpsV4WithWhitespaces($ip)
8787
{
88-
$this->validator->validate($ip, new Ip(array(
88+
$this->validator->validate($ip, new Ip([
8989
'version' => Ip::V4,
9090
'normalizer' => 'trim',
91-
)));
91+
]));
9292

9393
$this->assertNoViolation();
9494
}
9595

9696
public function getValidIpsV4WithWhitespaces()
9797
{
98-
return array(
99-
array("\x200.0.0.0"),
100-
array("\x09\x0910.0.0.0"),
101-
array("123.45.67.178\x0A"),
102-
array("172.16.0.0\x0D\x0D"),
103-
array("\x00192.168.1.0\x00"),
104-
array("\x0B\x0B224.0.0.1\x0B\x0B"),
105-
);
98+
return [
99+
["\x200.0.0.0"],
100+
["\x09\x0910.0.0.0"],
101+
["123.45.67.178\x0A"],
102+
["172.16.0.0\x0D\x0D"],
103+
["\x00192.168.1.0\x00"],
104+
["\x0B\x0B224.0.0.1\x0B\x0B"],
105+
];
106106
}
107107

108108
/**

‎src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LengthTest extends TestCase
2121
{
2222
public function testNormalizerCanBeSet()
2323
{
24-
$length = new Length(array('min' => 0, 'max' => 10, 'normalizer' => 'trim'));
24+
$length = new Length(['min' => 0, 'max' => 10, 'normalizer' => 'trim']);
2525

2626
$this->assertEquals('trim', $length->normalizer);
2727
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
3232
*/
3333
public function testInvalidNormalizerThrowsException()
3434
{
35-
new Length(array('min' => 0, 'max' => 10, 'normalizer' => 'Unknown Callable'));
35+
new Length(['min' => 0, 'max' => 10, 'normalizer' => 'Unknown Callable']);
3636
}
3737

3838
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
4141
*/
4242
public function testInvalidNormalizerObjectThrowsException()
4343
{
44-
new Length(array('min' => 0, 'max' => 10, 'normalizer' => new \stdClass()));
44+
new Length(['min' => 0, 'max' => 10, 'normalizer' => new \stdClass()]);
4545
}
4646
}

‎src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ public function getOneCharset()
9494

9595
public function getThreeCharactersWithWhitespaces()
9696
{
97-
return array(
98-
array("\x20ccc"),
99-
array("\x09c\x09c"),
100-
array("\x0Accc\x0A"),
101-
array("ccc\x0D\x0D"),
102-
array("\x00ccc\x00"),
103-
array("\x0Bc\x0Bc\x0B"),
104-
);
97+
return [
98+
["\x20ccc"],
99+
["\x09c\x09c"],
100+
["\x0Accc\x0A"],
101+
["ccc\x0D\x0D"],
102+
["\x00ccc\x00"],
103+
["\x0Bc\x0Bc\x0B"],
104+
];
105105
}
106106

107107
/**
@@ -142,7 +142,7 @@ public function testValidValuesExact($value)
142142
*/
143143
public function testValidNormalizedValues($value)
144144
{
145-
$constraint = new Length(array('min' => 3, 'max' => 3, 'normalizer' => 'trim'));
145+
$constraint = new Length(['min' => 3, 'max' => 3, 'normalizer' => 'trim']);
146146
$this->validator->validate($value, $constraint);
147147

148148
$this->assertNoViolation();

‎src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class NotBlankTest extends TestCase
2121
{
2222
public function testNormalizerCanBeSet()
2323
{
24-
$notBlank = new NotBlank(array('normalizer' => 'trim'));
24+
$notBlank = new NotBlank(['normalizer' => 'trim']);
2525

2626
$this->assertEquals('trim', $notBlank->normalizer);
2727
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
3232
*/
3333
public function testInvalidNormalizerThrowsException()
3434
{
35-
new NotBlank(array('normalizer' => 'Unknown Callable'));
35+
new NotBlank(['normalizer' => 'Unknown Callable']);
3636
}
3737

3838
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
4141
*/
4242
public function testInvalidNormalizerObjectThrowsException()
4343
{
44-
new NotBlank(array('normalizer' => new \stdClass()));
44+
new NotBlank(['normalizer' => new \stdClass()]);
4545
}
4646
}

‎src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ public function testAllowNullFalse()
130130
*/
131131
public function testNormalizedStringIsInvalid($value)
132132
{
133-
$constraint = new NotBlank(array(
133+
$constraint = new NotBlank([
134134
'message' => 'myMessage',
135135
'normalizer' => 'trim',
136-
));
136+
]);
137137

138138
$this->validator->validate($value, $constraint);
139139

@@ -145,13 +145,13 @@ public function testNormalizedStringIsInvalid($value)
145145

146146
public function getWhitespaces()
147147
{
148-
return array(
149-
array("\x20"),
150-
array("\x09\x09"),
151-
array("\x0A"),
152-
array("\x0D\x0D"),
153-
array("\x00"),
154-
array("\x0B\x0B"),
155-
);
148+
return [
149+
["\x20"],
150+
["\x09\x09"],
151+
["\x0A"],
152+
["\x0D\x0D"],
153+
["\x00"],
154+
["\x0B\x0B"],
155+
];
156156
}
157157
}

‎src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testGetCustomHtmlPattern()
8888

8989
public function testNormalizerCanBeSet()
9090
{
91-
$regex = new Regex(array('pattern' => '/^[0-9]+$/', 'normalizer' => 'trim'));
91+
$regex = new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'trim']);
9292

9393
$this->assertEquals('trim', $regex->normalizer);
9494
}
@@ -99,7 +99,7 @@ public function testNormalizerCanBeSet()
9999
*/
100100
public function testInvalidNormalizerThrowsException()
101101
{
102-
new Regex(array('pattern' => '/^[0-9]+$/', 'normalizer' => 'Unknown Callable'));
102+
new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'Unknown Callable']);
103103
}
104104

105105
/**
@@ -108,6 +108,6 @@ public function testInvalidNormalizerThrowsException()
108108
*/
109109
public function testInvalidNormalizerObjectThrowsException()
110110
{
111-
new Regex(array('pattern' => '/^[0-9]+$/', 'normalizer' => new \stdClass()));
111+
new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => new \stdClass()]);
112112
}
113113
}

‎src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testValidValues($value)
6060
*/
6161
public function testValidValuesWithWhitespaces($value)
6262
{
63-
$constraint = new Regex(array('pattern' => '/^[0-9]+$/', 'normalizer' => 'trim'));
63+
$constraint = new Regex(['pattern' => '/^[0-9]+$/', 'normalizer' => 'trim']);
6464
$this->validator->validate($value, $constraint);
6565

6666
$this->assertNoViolation();
@@ -84,14 +84,14 @@ public function __toString()
8484

8585
public function getValidValuesWithWhitespaces()
8686
{
87-
return array(
88-
array("\x207"),
89-
array("\x09\x09070707\x09\x09"),
90-
array("70707\x0A"),
91-
array("7\x0D\x0D"),
92-
array("\x00070707\x00"),
93-
array("\x0B\x0B70707\x0B\x0B"),
94-
);
87+
return [
88+
["\x207"],
89+
["\x09\x09070707\x09\x09"],
90+
["70707\x0A"],
91+
["7\x0D\x0D"],
92+
["\x00070707\x00"],
93+
["\x0B\x0B70707\x0B\x0B"],
94+
];
9595
}
9696

9797
/**

‎src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UrlTest extends TestCase
2121
{
2222
public function testNormalizerCanBeSet()
2323
{
24-
$url = new Url(array('normalizer' => 'trim'));
24+
$url = new Url(['normalizer' => 'trim']);
2525

2626
$this->assertEquals('trim', $url->normalizer);
2727
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
3232
*/
3333
public function testInvalidNormalizerThrowsException()
3434
{
35-
new Url(array('normalizer' => 'Unknown Callable'));
35+
new Url(['normalizer' => 'Unknown Callable']);
3636
}
3737

3838
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
4141
*/
4242
public function testInvalidNormalizerObjectThrowsException()
4343
{
44-
new Url(array('normalizer' => new \stdClass()));
44+
new Url(['normalizer' => new \stdClass()]);
4545
}
4646
}

‎src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testValidUrls($url)
7070
*/
7171
public function testValidUrlsWithWhitespaces($url)
7272
{
73-
$this->validator->validate($url, new Url(array('normalizer' => 'trim')));
73+
$this->validator->validate($url, new Url(['normalizer' => 'trim']));
7474

7575
$this->assertNoViolation();
7676
}
@@ -166,14 +166,14 @@ public function getValidUrls()
166166

167167
public function getValidUrlsWithWhitespaces()
168168
{
169-
return array(
170-
array("\x20http://www.google.com"),
171-
array("\x09\x09http://www.google.com."),
172-
array("http://symfony.fake/blog/\x0A"),
173-
array("http://symfony.com/search?type=&q=url+validator\x0D\x0D"),
174-
array("\x00https://google.com:80\x00"),
175-
array("\x0B\x0Bhttp://username:password@symfony.com\x0B\x0B"),
176-
);
169+
return [
170+
["\x20http://www.google.com"],
171+
["\x09\x09http://www.google.com."],
172+
["http://symfony.fake/blog/\x0A"],
173+
["http://symfony.com/search?type=&q=url+validator\x0D\x0D"],
174+
["\x00https://google.com:80\x00"],
175+
["\x0B\x0Bhttp://username:password@symfony.com\x0B\x0B"],
176+
];
177177
}
178178

179179
/**

‎src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UuidTest extends TestCase
2121
{
2222
public function testNormalizerCanBeSet()
2323
{
24-
$uuid = new Uuid(array('normalizer' => 'trim'));
24+
$uuid = new Uuid(['normalizer' => 'trim']);
2525

2626
$this->assertEquals('trim', $uuid->normalizer);
2727
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
3232
*/
3333
public function testInvalidNormalizerThrowsException()
3434
{
35-
new Uuid(array('normalizer' => 'Unknown Callable'));
35+
new Uuid(['normalizer' => 'Unknown Callable']);
3636
}
3737

3838
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
4141
*/
4242
public function testInvalidNormalizerObjectThrowsException()
4343
{
44-
new Uuid(array('normalizer' => new \stdClass()));
44+
new Uuid(['normalizer' => new \stdClass()]);
4545
}
4646
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.