File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -121,12 +121,14 @@ The validator class only has one required method ``validate()``::
121
121
// ...
122
122
}
123
123
124
- if (!preg_match('/^[a-zA-Z0-9]+$/', $value, $matches)) {
125
- // the argument must be a string or an object implementing __toString()
126
- $this->context->buildViolation($constraint->message)
127
- ->setParameter('{{ string }}', $value)
128
- ->addViolation();
124
+ if (preg_match('/^[a-zA-Z0-9]+$/', $value, $matches)) {
125
+ return;
129
126
}
127
+
128
+ // the argument must be a string or an object implementing __toString()
129
+ $this->context->buildViolation($constraint->message)
130
+ ->setParameter('{{ string }}', $value)
131
+ ->addViolation();
130
132
}
131
133
}
132
134
@@ -547,3 +549,4 @@ class to simplify writing unit tests for your custom constraints::
547
549
// ...
548
550
}
549
551
}
552
+
You can’t perform that action at this time.
0 commit comments