Skip to content

Commit 4a5d9e3

Browse files
committed
fixed CS
1 parent c1694fa commit 4a5d9e3

11 files changed

+365
-365
lines changed

Constraints/Email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class Email extends Constraint
4040
*
4141
* @internal
4242
*/
43-
public static $validationModes = array(
43+
public static $validationModes = [
4444
self::VALIDATION_MODE_HTML5,
4545
self::VALIDATION_MODE_STRICT,
4646
self::VALIDATION_MODE_LOOSE,
47-
);
47+
];
4848

4949
public $message = 'This value is not a valid email address.';
5050
public $checkMX = false;

Constraints/EmailValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class EmailValidator extends ConstraintValidator
3333
*/
3434
const PATTERN_LOOSE = '/^.+\@\S+\.\S+$/';
3535

36-
private static $emailPatterns = array(
36+
private static $emailPatterns = [
3737
Email::VALIDATION_MODE_LOOSE => self::PATTERN_LOOSE,
3838
Email::VALIDATION_MODE_HTML5 => self::PATTERN_HTML5,
39-
);
39+
];
4040

4141
/**
4242
* @var string

Constraints/Expression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Expression extends Constraint
3030

3131
public $message = 'This value is not valid.';
3232
public $expression;
33-
public $values = array();
33+
public $values = [];
3434

3535
/**
3636
* {@inheritdoc}

Constraints/Url.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@ class Url extends Constraint
8888

8989
const INVALID_URL_ERROR = '57c2f299-1154-4870-89bb-ef3b1f5ad229';
9090

91-
protected static $errorNames = array(
91+
protected static $errorNames = [
9292
self::INVALID_URL_ERROR => 'INVALID_URL_ERROR',
93-
);
93+
];
9494

9595
public $message = 'This value is not a valid URL.';
9696

9797
/**
9898
* @deprecated since Symfony 4.1
9999
*/
100100
public $dnsMessage = 'The host could not be resolved.';
101-
public $protocols = array('http', 'https');
101+
public $protocols = ['http', 'https'];
102102

103103
/**
104104
* @deprecated since Symfony 4.1

Constraints/UrlValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function validate($value, Constraint $constraint)
7474
}
7575

7676
if ($constraint->checkDNS) {
77-
if (!\in_array($constraint->checkDNS, array(
77+
if (!\in_array($constraint->checkDNS, [
7878
Url::CHECK_DNS_TYPE_ANY,
7979
Url::CHECK_DNS_TYPE_A,
8080
Url::CHECK_DNS_TYPE_A6,
@@ -87,8 +87,8 @@ public function validate($value, Constraint $constraint)
8787
Url::CHECK_DNS_TYPE_SOA,
8888
Url::CHECK_DNS_TYPE_SRV,
8989
Url::CHECK_DNS_TYPE_TXT,
90-
), true)) {
91-
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), array('checkDNS'));
90+
], true)) {
91+
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), ['checkDNS']);
9292
}
9393

9494
$host = parse_url($value, PHP_URL_HOST);

Tests/Constraints/ChoiceValidatorTest.php

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
function choice_callback()
1919
{
20-
return array('foo', 'bar');
20+
return ['foo', 'bar'];
2121
}
2222

2323
class ChoiceValidatorTest extends ConstraintValidatorTestCase
@@ -29,23 +29,23 @@ protected function createValidator()
2929

3030
public static function staticCallback()
3131
{
32-
return array('foo', 'bar');
32+
return ['foo', 'bar'];
3333
}
3434

3535
public function objectMethodCallback()
3636
{
37-
return array('foo', 'bar');
37+
return ['foo', 'bar'];
3838
}
3939

4040
/**
4141
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
4242
*/
4343
public function testExpectArrayIfMultipleIsTrue()
4444
{
45-
$constraint = new Choice(array(
46-
'choices' => array('foo', 'bar'),
45+
$constraint = new Choice([
46+
'choices' => ['foo', 'bar'],
4747
'multiple' => true,
48-
));
48+
]);
4949

5050
$this->validator->validate('asdf', $constraint);
5151
}
@@ -55,9 +55,9 @@ public function testNullIsValid()
5555
$this->validator->validate(
5656
null,
5757
new Choice(
58-
array(
59-
'choices' => array('foo', 'bar'),
60-
)
58+
[
59+
'choices' => ['foo', 'bar'],
60+
]
6161
)
6262
);
6363

@@ -77,12 +77,12 @@ public function testChoicesOrCallbackExpected()
7777
*/
7878
public function testValidCallbackExpected()
7979
{
80-
$this->validator->validate('foobar', new Choice(array('callback' => 'abcd')));
80+
$this->validator->validate('foobar', new Choice(['callback' => 'abcd']));
8181
}
8282

8383
public function testValidChoiceArray()
8484
{
85-
$constraint = new Choice(array('choices' => array('foo', 'bar')));
85+
$constraint = new Choice(['choices' => ['foo', 'bar']]);
8686

8787
$this->validator->validate('bar', $constraint);
8888

@@ -91,7 +91,7 @@ public function testValidChoiceArray()
9191

9292
public function testValidChoiceCallbackFunction()
9393
{
94-
$constraint = new Choice(array('callback' => __NAMESPACE__.'\choice_callback'));
94+
$constraint = new Choice(['callback' => __NAMESPACE__.'\choice_callback']);
9595

9696
$this->validator->validate('bar', $constraint);
9797

@@ -101,11 +101,11 @@ public function testValidChoiceCallbackFunction()
101101
public function testValidChoiceCallbackClosure()
102102
{
103103
$constraint = new Choice(
104-
array(
104+
[
105105
'callback' => function () {
106-
return array('foo', 'bar');
106+
return ['foo', 'bar'];
107107
},
108-
)
108+
]
109109
);
110110

111111
$this->validator->validate('bar', $constraint);
@@ -115,7 +115,7 @@ public function testValidChoiceCallbackClosure()
115115

116116
public function testValidChoiceCallbackStaticMethod()
117117
{
118-
$constraint = new Choice(array('callback' => array(__CLASS__, 'staticCallback')));
118+
$constraint = new Choice(['callback' => [__CLASS__, 'staticCallback']]);
119119

120120
$this->validator->validate('bar', $constraint);
121121

@@ -127,7 +127,7 @@ public function testValidChoiceCallbackContextMethod()
127127
// search $this for "staticCallback"
128128
$this->setObject($this);
129129

130-
$constraint = new Choice(array('callback' => 'staticCallback'));
130+
$constraint = new Choice(['callback' => 'staticCallback']);
131131

132132
$this->validator->validate('bar', $constraint);
133133

@@ -139,7 +139,7 @@ public function testValidChoiceCallbackContextObjectMethod()
139139
// search $this for "objectMethodCallback"
140140
$this->setObject($this);
141141

142-
$constraint = new Choice(array('callback' => 'objectMethodCallback'));
142+
$constraint = new Choice(['callback' => 'objectMethodCallback']);
143143

144144
$this->validator->validate('bar', $constraint);
145145

@@ -148,22 +148,22 @@ public function testValidChoiceCallbackContextObjectMethod()
148148

149149
public function testMultipleChoices()
150150
{
151-
$constraint = new Choice(array(
152-
'choices' => array('foo', 'bar', 'baz'),
151+
$constraint = new Choice([
152+
'choices' => ['foo', 'bar', 'baz'],
153153
'multiple' => true,
154-
));
154+
]);
155155

156-
$this->validator->validate(array('baz', 'bar'), $constraint);
156+
$this->validator->validate(['baz', 'bar'], $constraint);
157157

158158
$this->assertNoViolation();
159159
}
160160

161161
public function testInvalidChoice()
162162
{
163-
$constraint = new Choice(array(
164-
'choices' => array('foo', 'bar'),
163+
$constraint = new Choice([
164+
'choices' => ['foo', 'bar'],
165165
'message' => 'myMessage',
166-
));
166+
]);
167167

168168
$this->validator->validate('baz', $constraint);
169169

@@ -175,12 +175,12 @@ public function testInvalidChoice()
175175

176176
public function testInvalidChoiceEmptyChoices()
177177
{
178-
$constraint = new Choice(array(
178+
$constraint = new Choice([
179179
// May happen when the choices are provided dynamically, e.g. from
180180
// the DB or the model
181-
'choices' => array(),
181+
'choices' => [],
182182
'message' => 'myMessage',
183-
));
183+
]);
184184

185185
$this->validator->validate('baz', $constraint);
186186

@@ -192,13 +192,13 @@ public function testInvalidChoiceEmptyChoices()
192192

193193
public function testInvalidChoiceMultiple()
194194
{
195-
$constraint = new Choice(array(
196-
'choices' => array('foo', 'bar'),
195+
$constraint = new Choice([
196+
'choices' => ['foo', 'bar'],
197197
'multipleMessage' => 'myMessage',
198198
'multiple' => true,
199-
));
199+
]);
200200

201-
$this->validator->validate(array('foo', 'baz'), $constraint);
201+
$this->validator->validate(['foo', 'baz'], $constraint);
202202

203203
$this->buildViolation('myMessage')
204204
->setParameter('{{ value }}', '"baz"')
@@ -209,14 +209,14 @@ public function testInvalidChoiceMultiple()
209209

210210
public function testTooFewChoices()
211211
{
212-
$constraint = new Choice(array(
213-
'choices' => array('foo', 'bar', 'moo', 'maa'),
212+
$constraint = new Choice([
213+
'choices' => ['foo', 'bar', 'moo', 'maa'],
214214
'multiple' => true,
215215
'min' => 2,
216216
'minMessage' => 'myMessage',
217-
));
217+
]);
218218

219-
$value = array('foo');
219+
$value = ['foo'];
220220

221221
$this->setValue($value);
222222

@@ -232,14 +232,14 @@ public function testTooFewChoices()
232232

233233
public function testTooManyChoices()
234234
{
235-
$constraint = new Choice(array(
236-
'choices' => array('foo', 'bar', 'moo', 'maa'),
235+
$constraint = new Choice([
236+
'choices' => ['foo', 'bar', 'moo', 'maa'],
237237
'multiple' => true,
238238
'max' => 2,
239239
'maxMessage' => 'myMessage',
240-
));
240+
]);
241241

242-
$value = array('foo', 'bar', 'moo');
242+
$value = ['foo', 'bar', 'moo'];
243243

244244
$this->setValue($value);
245245

@@ -255,9 +255,9 @@ public function testTooManyChoices()
255255

256256
public function testStrictAllowsExactValue()
257257
{
258-
$constraint = new Choice(array(
259-
'choices' => array(1, 2),
260-
));
258+
$constraint = new Choice([
259+
'choices' => [1, 2],
260+
]);
261261

262262
$this->validator->validate(2, $constraint);
263263

@@ -266,10 +266,10 @@ public function testStrictAllowsExactValue()
266266

267267
public function testStrictDisallowsDifferentType()
268268
{
269-
$constraint = new Choice(array(
270-
'choices' => array(1, 2),
269+
$constraint = new Choice([
270+
'choices' => [1, 2],
271271
'message' => 'myMessage',
272-
));
272+
]);
273273

274274
$this->validator->validate('2', $constraint);
275275

@@ -281,13 +281,13 @@ public function testStrictDisallowsDifferentType()
281281

282282
public function testStrictWithMultipleChoices()
283283
{
284-
$constraint = new Choice(array(
285-
'choices' => array(1, 2, 3),
284+
$constraint = new Choice([
285+
'choices' => [1, 2, 3],
286286
'multiple' => true,
287287
'multipleMessage' => 'myMessage',
288-
));
288+
]);
289289

290-
$this->validator->validate(array(2, '3'), $constraint);
290+
$this->validator->validate([2, '3'], $constraint);
291291

292292
$this->buildViolation('myMessage')
293293
->setParameter('{{ value }}', '"3"')

Tests/Constraints/EmailTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ class EmailTest extends TestCase
2222
*/
2323
public function testLegacyConstructorStrict()
2424
{
25-
$subject = new Email(array('strict' => true));
25+
$subject = new Email(['strict' => true]);
2626

2727
$this->assertTrue($subject->strict);
2828
}
2929

3030
public function testConstructorStrict()
3131
{
32-
$subject = new Email(array('mode' => Email::VALIDATION_MODE_STRICT));
32+
$subject = new Email(['mode' => Email::VALIDATION_MODE_STRICT]);
3333

3434
$this->assertEquals(Email::VALIDATION_MODE_STRICT, $subject->mode);
3535
}
@@ -40,6 +40,6 @@ public function testConstructorStrict()
4040
*/
4141
public function testUnknownModesTriggerException()
4242
{
43-
new Email(array('mode' => 'Unknown Mode'));
43+
new Email(['mode' => 'Unknown Mode']);
4444
}
4545
}

0 commit comments

Comments
 (0)