mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Optimized code for identifer established by the rpc client that must contain a string,number or null if included. (#5901)
This commit is contained in:
parent
bea995fb37
commit
e736786d15
@ -34,6 +34,7 @@
|
|||||||
- [#5866](https://github.com/hyperf/hyperf/pull/5866) Use `StrCache` instead of `Str` in special cases.
|
- [#5866](https://github.com/hyperf/hyperf/pull/5866) Use `StrCache` instead of `Str` in special cases.
|
||||||
- [#5872](https://github.com/hyperf/hyperf/pull/5872) Avoid to execute the refresh callback more than once when calling `refresh()` multi times.
|
- [#5872](https://github.com/hyperf/hyperf/pull/5872) Avoid to execute the refresh callback more than once when calling `refresh()` multi times.
|
||||||
- [#5879](https://github.com/hyperf/hyperf/pull/5879) [#5878](https://github.com/hyperf/hyperf/pull/5878) Improve `Command`.
|
- [#5879](https://github.com/hyperf/hyperf/pull/5879) [#5878](https://github.com/hyperf/hyperf/pull/5878) Improve `Command`.
|
||||||
|
- [#5901](https://github.com/hyperf/hyperf/pull/5901) Optimized code for identifer established by the rpc client that must contain a string,number or null if included.
|
||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ abstract class AbstractServiceClient
|
|||||||
return $this->pathGenerator->generate($this->serviceName, $methodName);
|
return $this->pathGenerator->generate($this->serviceName, $methodName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function __generateData(string $methodName, array $params, ?string $id)
|
protected function __generateData(string $methodName, array $params, null|int|string $id)
|
||||||
{
|
{
|
||||||
return $this->dataFormatter->formatRequest(new Request($this->__generateRpcPath($methodName), $params, $id));
|
return $this->dataFormatter->formatRequest(new Request($this->__generateRpcPath($methodName), $params, $id));
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ namespace Hyperf\Rpc;
|
|||||||
|
|
||||||
class ErrorResponse
|
class ErrorResponse
|
||||||
{
|
{
|
||||||
public function __construct(protected ?string $id, protected int $code, protected string $message, protected mixed $exception)
|
public function __construct(protected null|int|string $id, protected int $code, protected string $message, protected mixed $exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?string
|
public function getId(): null|int|string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace Hyperf\Rpc;
|
|||||||
|
|
||||||
class Request
|
class Request
|
||||||
{
|
{
|
||||||
public function __construct(protected string $path, protected array $params, protected ?string $id = null)
|
public function __construct(protected string $path, protected array $params, protected null|int|string $id = null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class Request
|
|||||||
return $this->params;
|
return $this->params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?string
|
public function getId(): null|int|string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ namespace Hyperf\Rpc;
|
|||||||
|
|
||||||
class Response
|
class Response
|
||||||
{
|
{
|
||||||
public function __construct(protected ?string $id, protected mixed $result)
|
public function __construct(protected null|int|string $id, protected mixed $result)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?string
|
public function getId(): null|int|string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user