[phonenumber validation] allow to validate against landline and mobile

phonenumbers
This commit is contained in:
2020-02-10 13:03:57 +01:00
parent d46ee72fb1
commit e348616d00
5 changed files with 30 additions and 3 deletions

View File

@@ -70,10 +70,14 @@ class ValidPhonenumber extends ConstraintValidator
$isValid = $this->phonenumberHelper->isValidPhonenumberMobile($value);
$message = $constraint->notMobileMessage;
break;
case 'any':
$isValid = $this->phonenumberHelper->isValidPhonenumberAny($value);
$message = $constraint->notValidMessage;
break;
default:
throw new \LogicException(sprintf("This type '%s' is not implemented. "
. "Possible values are 'mobile', 'landline'"), $constraint->type);
. "Possible values are 'mobile', 'landline' or 'any'", $constraint->type));
}
if (FALSE === $isValid) {