Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Constraints/CallbackValidator.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
33 } | 33 } |
34 | 34 |
35 $method = $constraint->callback; | 35 $method = $constraint->callback; |
36 if ($method instanceof \Closure) { | 36 if ($method instanceof \Closure) { |
37 $method($object, $this->context, $constraint->payload); | 37 $method($object, $this->context, $constraint->payload); |
38 } elseif (is_array($method)) { | 38 } elseif (\is_array($method)) { |
39 if (!is_callable($method)) { | 39 if (!\is_callable($method)) { |
40 if (isset($method[0]) && is_object($method[0])) { | 40 if (isset($method[0]) && \is_object($method[0])) { |
41 $method[0] = get_class($method[0]); | 41 $method[0] = \get_class($method[0]); |
42 } | 42 } |
43 throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method))); | 43 throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method))); |
44 } | 44 } |
45 | 45 |
46 call_user_func($method, $object, $this->context, $constraint->payload); | 46 \call_user_func($method, $object, $this->context, $constraint->payload); |
47 } elseif (null !== $object) { | 47 } elseif (null !== $object) { |
48 if (!method_exists($object, $method)) { | 48 if (!method_exists($object, $method)) { |
49 throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, get_class($object))); | 49 throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object))); |
50 } | 50 } |
51 | 51 |
52 $reflMethod = new \ReflectionMethod($object, $method); | 52 $reflMethod = new \ReflectionMethod($object, $method); |
53 | 53 |
54 if ($reflMethod->isStatic()) { | 54 if ($reflMethod->isStatic()) { |