$method = $constraint->callback;
if ($method instanceof \Closure) {
$method($object, $this->context, $constraint->payload);
- } elseif (is_array($method)) {
- if (!is_callable($method)) {
- if (isset($method[0]) && is_object($method[0])) {
- $method[0] = get_class($method[0]);
+ } elseif (\is_array($method)) {
+ if (!\is_callable($method)) {
+ if (isset($method[0]) && \is_object($method[0])) {
+ $method[0] = \get_class($method[0]);
}
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
}
- call_user_func($method, $object, $this->context, $constraint->payload);
+ \call_user_func($method, $object, $this->context, $constraint->payload);
} elseif (null !== $object) {
if (!method_exists($object, $method)) {
- throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, get_class($object)));
+ throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));
}
$reflMethod = new \ReflectionMethod($object, $method);