Expand valid RpcRequest result types
This commit is contained in:
parent
51a1136380
commit
76c3629be2
1 changed files with 13 additions and 1 deletions
|
@ -108,6 +108,18 @@ class RpcRequest implements SerializableInterface
|
||||||
{
|
{
|
||||||
$valid = true;
|
$valid = true;
|
||||||
}
|
}
|
||||||
|
elseif(is_string($result))
|
||||||
|
{
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
|
elseif(is_bool($result))
|
||||||
|
{
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
|
elseif(is_int($result))
|
||||||
|
{
|
||||||
|
$valid = true;
|
||||||
|
}
|
||||||
elseif(is_null($result))
|
elseif(is_null($result))
|
||||||
{
|
{
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
@ -115,7 +127,7 @@ class RpcRequest implements SerializableInterface
|
||||||
|
|
||||||
if(!$valid)
|
if(!$valid)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException('The \'$result\' property must either be array, null or SerializableInterface');
|
throw new InvalidArgumentException('The \'$result\' property must either be string, boolean, integer, array, null or SerializableInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RpcResponse($this->id, $result);
|
return new RpcResponse($this->id, $result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue