Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Simplify callback call
  • Loading branch information
Mathieu Lechat committed Nov 16, 2017
commit 1e461b10333ab938f3399373dc407b001d232a32
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public function validate($object, Constraint $constraint)
}

if (1 === count($result)) {
$match = $result instanceof \Iterator ? $result->current() : current($result);
$entity = $result instanceof \Iterator ? $result->current() : current($result);

if ($object === $match) {
if ($object === $entity) {
return;
}

Expand All @@ -160,9 +160,7 @@ public function validate($object, Constraint $constraint)
throw new ConstraintDefinitionException(sprintf('Method "%s" does not exist in class %s', $method, $objectClass));
}

$reflMethod = new \ReflectionMethod($object, $method);

if ($reflMethod->isStatic() ? $reflMethod->invoke(null, $object, $match) : $reflMethod->invoke($object, $match)) {
if (call_user_func([$object, $method], $entity)) {
return;
}
}
Expand Down