"__call()" should be displayed only if $this->magicCall is true

This commit is contained in:
Abdellatif AitBoudad 2013-11-06 08:08:50 +00:00 committed by Fabien Potencier
parent d7db2452f1
commit 5b0f8787cf

View File

@ -228,14 +228,15 @@ class PropertyAccessor implements PropertyAccessorInterface
// we call the getter and hope the __call do the job
$result[self::VALUE] = $object->$getter();
} else {
$methods = array($getter, $isser, $hasser, '__get');
if ($this->magicCall) {
$methods[] = '__call';
}
throw new NoSuchPropertyException(sprintf(
'Neither the property "%s" nor one of the methods "%s()", '.
'"%s()", "%s()", "__get()" or "__call()" exist and have public access in '.
'class "%s".',
'Neither the property "%s" nor one of the methods "'. implode('()", "', $methods).'() '.
'exist and have public access in class "%s".',
$property,
$getter,
$isser,
$hasser,
$reflClass->name
));
}