Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13ba8ad

Browse files
committed
Fix coding standards
1 parent cc65f3c commit 13ba8ad

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

src/Symfony/Component/Validator/Constraints/Json.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
*/
2222
class Json extends Constraint
2323
{
24-
const NOT_JSON_ERROR = '0789c8ad-2d2b-49a4-8356-e2ce63998504';
24+
const INVALID_JSON_ERROR = '0789c8ad-2d2b-49a4-8356-e2ce63998504';
2525

26-
protected static $errorNames = array(
27-
self::NOT_JSON_ERROR => 'NOT_JSON_ERROR',
28-
);
26+
protected static $errorNames = [
27+
self::INVALID_JSON_ERROR => 'INVALID_JSON_ERROR',
28+
];
2929

3030
public $message = 'This value should be valid JSON.';
3131
}

src/Symfony/Component/Validator/Constraints/JsonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function validate($value, Constraint $constraint)
4444
if (JSON_ERROR_NONE !== json_last_error()) {
4545
$this->context->buildViolation($constraint->message)
4646
->setParameter('{{ value }}', $this->formatValue($value))
47-
->setCode(Json::NOT_JSON_ERROR)
47+
->setCode(Json::INVALID_JSON_ERROR)
4848
->addViolation();
4949
}
5050
}

src/Symfony/Component/Validator/Tests/Constraints/JsonValidatorTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,41 @@ public function testJsonIsValid($value)
3737
*/
3838
public function testInvalidValues($value)
3939
{
40-
$constraint = new Json(array(
40+
$constraint = new Json([
4141
'message' => 'myMessageTest',
42-
));
42+
]);
4343

4444
$this->validator->validate($value, $constraint);
4545

4646
$this->buildViolation('myMessageTest')
4747
->setParameter('{{ value }}', '"'.$value.'"')
48-
->setCode(Json::NOT_JSON_ERROR)
48+
->setCode(Json::INVALID_JSON_ERROR)
4949
->assertRaised();
5050
}
5151

5252
public function getValidValues()
5353
{
54-
return array(
55-
array('{"planet":"earth", "country": "Morocco","city": "Rabat" ,"postcode" : 10160, "is_great": true,
56-
"img" : null, "area": 118.5, "foo": 15 }'),
57-
array(null),
58-
array(''),
59-
array('"null"'),
60-
array('null'),
61-
array('"string"'),
62-
array('1'),
63-
array('true'),
64-
array(1),
65-
);
54+
return [
55+
['{"planet":"earth", "country": "Morocco","city": "Rabat" ,"postcode" : 10160, "is_great": true,
56+
"img" : null, "area": 118.5, "foo": 15 }'],
57+
[null],
58+
[''],
59+
['"null"'],
60+
['null'],
61+
['"string"'],
62+
['1'],
63+
['true'],
64+
[1],
65+
];
6666
}
6767

6868
public function getInvalidValues()
6969
{
70-
return array(
71-
array('{"foo": 3 "bar": 4}'),
72-
array('{"foo": 3 ,"bar": 4'),
73-
array('{foo": 3, "bar": 4}'),
74-
array('foo'),
75-
);
70+
return [
71+
['{"foo": 3 "bar": 4}'],
72+
['{"foo": 3 ,"bar": 4'],
73+
['{foo": 3, "bar": 4}'],
74+
['foo'],
75+
];
7676
}
7777
}

0 commit comments

Comments
 (0)