8000 fix feedbacks · symfony/symfony@2703ce3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2703ce3< 8000 /span>

Browse files
committed
fix feedbacks
1 parent 795467a commit 2703ce3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines 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

Lines 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