context->addViolation($constraint->message); } elseif (!preg_match('#[0-9]+#', $value)) { $this->context->addViolation($constraint->message); } elseif (!preg_match('#[a-zA-Z]+#', $value)) { $this->context->addViolation($constraint->message); } elseif (!preg_match("/[|!@#$%&*\/=?,;.:\-_+~^\\\]/", $value)) { $this->context->addViolation($constraint->message); } } } }