Skip to content

Commit bb30126

Browse files
thomasbisignanijaviereguiluz
authored andcommitted
Update custom_constraint.rst
1 parent 6e38d74 commit bb30126

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

validation/custom_constraint.rst

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ The validator class is also simple, and only has one required method ``validate(
6565
{
6666
public function validate($value, Constraint $constraint)
6767
{
68+
if (!$constraint instanceof ContainsAlphanumeric) {
69+
throw new UnexpectedTypeException($constraint, ContainsAlphanumeric::class);
70+
}
71+
6872
// custom constraints should ignore null and empty values to allow
6973
// other constraints (NotBlank, NotNull, etc.) take care of that
7074
if (null === $value || '' === $value) {

0 commit comments

Comments
 (0)