File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ class Error implements JsonSerializable
2626 ];
2727
2828 /** @var int A Number that indicates the error type that occurred. */
29- protected $ code ;
29+ protected int $ code ;
3030
3131 /** @var string A String providing a short description of the error. */
32- protected $ message ;
32+ protected string $ message ;
3333
3434 /** @var mixed Additional information about the error */
3535 protected $ data ;
@@ -46,7 +46,7 @@ public function setCode(int $code)
4646 $ this ->code = $ code ;
4747 }
4848
49- public function getCode ()
49+ public function getCode (): int
5050 {
5151 return $ this ->code ;
5252 }
@@ -56,7 +56,7 @@ public function setMessage(string $message)
5656 $ this ->message = $ message ;
5757 }
5858
59- public function getMessage ()
59+ public function getMessage (): string
6060 {
6161 return $ this ->message ;
6262 }
@@ -71,10 +71,12 @@ public function getData()
7171 return $ this ->data ;
7272 }
7373
74- public function jsonSerialize ()
74+ public function jsonSerialize () : array
7575 {
76- $ record = ['code ' => $ this ->code ,
77- 'message ' => $ this ->message ];
76+ $ record = [
77+ 'code ' => $ this ->code ,
78+ 'message ' => $ this ->message
79+ ];
7880
7981 if (null !== $ this ->data )
8082 {
Original file line number Diff line number Diff line change @@ -85,12 +85,14 @@ public function getParam(string $name)
8585 }
8686
8787 /**
88- * @return mixed
88+ * @return array
8989 */
90- public function jsonSerialize ()
90+ public function jsonSerialize () : array
9191 {
92- $ record = ['jsonrpc ' => self ::JSONRPC_VERSION ,
93- 'method ' => $ this ->method ];
92+ $ record = [
93+ 'jsonrpc ' => RpcMessageInterface::JSONRPC_VERSION ,
94+ 'method ' => $ this ->method
95+ ];
9496 if (!empty ($ this ->params ))
9597 {
9698 $ record ['params ' ] = $ this ->params ;
Original file line number Diff line number Diff line change @@ -66,9 +66,9 @@ public function getId()
6666 }
6767
6868 /**
69- * @return mixed
69+ * @return array
7070 */
71- public function jsonSerialize ()
71+ public function jsonSerialize () : array
7272 {
7373 $ record = parent ::jsonSerialize ();
7474 $ record ['id ' ] = $ this ->id ;
You can’t perform that action at this time.
0 commit comments