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 2703ce3

Browse filesBrowse files
committed
fix feedbacks
1 parent 795467a commit 2703ce3
Copy full SHA for 2703ce3

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed

‎src/Symfony/Component/Validator/Constraints/CountryValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/CountryValidator.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public function validate($value, Constraint $constraint)
4343

4444
$value = (string) $value;
4545

46-
if ((!$constraint->alpha3 && !Countries::exists($value)) ||
47-
($constraint->alpha3 && !Countries::alpha3CodeExists($value))) {
46+
if ($constraint->alpha3 ? !Countries::alpha3CodeExists($value) : !Countries::exists($value)) {
4847
$this->context->buildViolation($constraint->message)
4948
->setParameter('{{ value }}', $this->formatValue($value))
5049
->setCode(Country::NO_SUCH_COUNTRY_ERROR)

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ public function getInvalidAlpha3Countries()
147147
return [
148148
['foobar'],
149149
['GB'],
150+
['ZZZ'],
151+
['zzz'],
150152
];
151153
}
152154

0 commit comments

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