8000 [Validator] Remove \call_user_func() calls · symfony/symfony@8bb60ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bb60ea

Browse files
committed
[Validator] Remove \call_user_func() calls
1 parent 35bf173 commit 8bb60ea

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ CHANGELOG
88
* added UATP cards support to `CardSchemeValidator`
99
* added option `allowNull` to NotBlank constraint
1010
* added `Json` constraint
11-
11+
* added a new `normalizer` option to the string constraints and to the `NotBlank` constraint
12+
1213
4.2.0
1314
-----
1415

src/Symfony/Component/Validator/Constraints/EmailValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function validate($value, Constraint $constraint)
8282
$value = (string) $value;
8383

8484
if (null !== $constraint->normalizer) {
85-
$value = \call_user_func($constraint->normalizer, $value);
85+
$value = ($constraint->normalizer)($value);
8686
}
8787

8888
if (null !== $constraint->strict) {

src/Symfony/Component/Validator/Constraints/IpValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function validate($value, Constraint $constraint)
4444
$value = (string) $value;
4545

4646
if (null !== $constraint->normalizer) {
47-
$value = \call_user_func($constraint->normalizer, $value);
47+
$value = ($constraint->normalizer)($value);
4848
}
4949

5050
switch ($constraint->version) {

src/Symfony/Component/Validator/Constraints/LengthValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function validate($value, Constraint $constraint)
4141
$stringValue = (string) $value;
4242

4343
if (null !== $constraint->normalizer) {
44-
$stringValue = \call_user_func($constraint->normalizer, $stringValue);
44+
$stringValue = ($constraint->normalizer)($stringValue);
4545
}
4646

4747
if (!$invalidCharset = !@mb_check_encoding($stringValue, $constraint->charset)) {

src/Symfony/Component/Validator/Constraints/NotBlankValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function validate($value, Constraint $constraint)
3535
}
3636

3737
if (\is_string($value) && null !== $constraint->normalizer) {
38-
$value = \call_user_func($constraint->normalizer, $value);
38+
$value = ($constraint->normalizer)($value);
3939
}
4040

4141
if (false === $value || (empty($value) && '0' != $value)) {

src/Symfony/Component/Validator/Constraints/RegexValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function validate($value, Constraint $constraint)
4444
$value = (string) $value;
4545

4646
if (null !== $constraint->normalizer) {
47-
$value = \call_user_func($constraint->normalizer, $value);
47+
$value = ($constraint->normalizer)($value);
4848
}
4949

5050
if ($constraint->match xor preg_match($constraint->pattern, $value)) {

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function validate($value, Constraint $constraint)
6363
}
6464

6565
if (null !== $constraint->normalizer) {
66-
$value = \call_user_func($constraint->normalizer, $value);
66+
$value = ($constraint->normalizer)($value);
6767
}
6868

6969
$pattern = $constraint->relativeProtocol ? str_replace('(%s):', '(?:(%s):)?', static::PATTERN) : static::PATTERN;

src/Symfony/Component/Validator/Constraints/UuidValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function validate($value, Constraint $constraint)
8282
$value = (string) $value;
8383

8484
if (null !== $constraint->normalizer) {
85-
$value = \call_user_func($constraint->normalizer, $value);
85+
$value = ($constraint->normalizer)($value);
8686
}
8787

8888
if ($constraint->strict) {

0 commit comments

Comments
 (0)
0