minor #12967 Fix failing tests after merge (xabbuh, nicolas-grekas)

This PR was merged into the 2.5 branch.

Discussion
----------

Fix failing tests after merge

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

https://github.com/symfony/symfony/pull/12967/files?w=1

Commits
-------

9b96373 Fix failing tests after merge
6638535 fix ocramius/proxy-manager dependency version
This commit is contained in:
Fabien Potencier 2014-12-13 10:19:48 +01:00
commit 98c8ec1cbc
3 changed files with 12 additions and 18 deletions

View File

@ -72,7 +72,7 @@
"monolog/monolog": "~1.3",
"propel/propel1": "~1.6",
"ircmaxell/password-compat": "~1.0",
"ocramius/proxy-manager": "~0.3.1",
"ocramius/proxy-manager": "~0.4|~1.0",
"egulias/email-validator": "~1.2"
},
"autoload": {

View File

@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.3",
"symfony/dependency-injection": "~2.3",
"ocramius/proxy-manager": "~0.3.1"
"ocramius/proxy-manager": "~0.4|~1.0"
},
"require-dev": {
"symfony/config": "~2.3"

View File

@ -58,24 +58,18 @@ class CallbackValidator extends ConstraintValidator
}
call_user_func($method, $object, $this->context);
} elseif (null !== $object) {
if (!method_exists($object, $method)) {
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method));
}
continue;
}
$reflMethod = new \ReflectionMethod($object, $method);
if (null === $object) {
continue;
}
if (!method_exists($object, $method)) {
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method));
}
$reflMethod = new \ReflectionMethod($object, $method);
if ($reflMethod->isStatic()) {
$reflMethod->invoke(null, $object, $this->context);
} else {
$reflMethod->invoke($object, $this->context);
if ($reflMethod->isStatic()) {
$reflMethod->invoke(null, $object, $this->context);
} else {
$reflMethod->invoke($object, $this->context);
}
}
}
}