Fixed issue #10
This commit is contained in:
parent
a0a92dd1b4
commit
33d1e4031c
|
@ -67,17 +67,12 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
|
||||||
|
|
||||||
$this->messageRefs[$hash] = $message;
|
$this->messageRefs[$hash] = $message;
|
||||||
|
|
||||||
$class = $phpType;
|
if (!$message instanceof $phpType) {
|
||||||
if ($class[0] == '\\') {
|
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', get_class($message), $phpType));
|
||||||
$class = substr($class, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$message instanceof $class) {
|
|
||||||
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', get_class($message), $class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = new \ReflectionClass($message);
|
$r = new \ReflectionClass($message);
|
||||||
foreach ($this->definitionComplexTypes[$class] as $type) {
|
foreach ($this->definitionComplexTypes[$phpType] as $type) {
|
||||||
$p = $r->getProperty($type->getName());
|
$p = $r->getProperty($type->getName());
|
||||||
if ($p->isPublic()) {
|
if ($p->isPublic()) {
|
||||||
$value = $message->{$type->getName()};
|
$value = $message->{$type->getName()};
|
||||||
|
@ -91,7 +86,7 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$type->isNillable() && null === $value) {
|
if (!$type->isNillable() && null === $value) {
|
||||||
throw new \InvalidArgumentException(sprintf('"%s::%s" cannot be null.', $class, $type->getName()));
|
throw new \InvalidArgumentException(sprintf('"%s::%s" cannot be null.', $phpType, $type->getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,11 @@ class Type
|
||||||
|
|
||||||
public function setPhpType($phpType)
|
public function setPhpType($phpType)
|
||||||
{
|
{
|
||||||
|
$phpType = $phpType;
|
||||||
|
if ($phpType[0] == '\\') {
|
||||||
|
$phpType = substr($phpType, 1);
|
||||||
|
}
|
||||||
|
|
||||||
$this->phpType = $phpType;
|
$this->phpType = $phpType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue