Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit324d85f

Browse files
committed
minor#10671 Update custom_constraint.rst (thomasbisignani)
This PR was submitted for the 4.1 branch but it was merged into the 2.8 branch instead (closes#10671).Discussion----------Update custom_constraint.rstJust added the constraint check to limit the `ContainsAlphanumericValidator` use with the `ContainsAlphanumeric` constraint.Commits-------bb30126 Update custom_constraint.rst
2 parents6e38d74 +bb30126 commit324d85f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎validation/custom_constraint.rst‎

Lines changed: 4 additions & 0 deletions
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)

[8]ページ先頭

©2009-2025 Movatter.jp