Expand valid RpcRequest result types

This commit is contained in:
netkas 2024-09-27 14:21:27 -04:00
parent 51a1136380
commit 76c3629be2

View file

@ -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);