Skip to content

Commit 0f0f887

Browse files
committed
Optimize perf by replacing call_user_func with dynamic vars
1 parent ba6e80f commit 0f0f887

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Constraints/CallbackValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function validate($object, Constraint $constraint)
4343
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
4444
}
4545

46-
\call_user_func($method, $object, $this->context, $constraint->payload);
46+
$method($object, $this->context, $constraint->payload);
4747
} elseif (null !== $object) {
4848
if (!method_exists($object, $method)) {
4949
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));

Constraints/ChoiceValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function validate($value, Constraint $constraint)
5353
) {
5454
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback');
5555
}
56-
$choices = \call_user_func($choices);
56+
$choices = $choices();
5757
} else {
5858
$choices = $constraint->choices;
5959
}

0 commit comments

Comments
 (0)