@@ -29,8 +29,8 @@ public function __construct(MethodResolverInterface $methodResolver, CustomExcep
29
29
}
30
30
31
31
/**
32
- * @param string $methodName
33
- * @param array $paramList
32
+ * @param string $methodName
33
+ * @param array|null $paramList
34
34
*
35
35
* @return mixed
36
36
*
@@ -46,7 +46,7 @@ public function apply(string $methodName, array $paramList = null)
46
46
throw new JsonRpcMethodNotFoundException ($ methodName );
47
47
}
48
48
49
- $ this ->validateParamsIfNeeded ($ method , $ paramList );
49
+ $ this ->validateParams ($ method , $ paramList );
50
50
51
51
try {
52
52
return $ method ->apply ($ paramList );
@@ -57,20 +57,18 @@ public function apply(string $methodName, array $paramList = null)
57
57
58
58
/**
59
59
* @param JsonRpcMethodInterface $method
60
- * @param array|mixed $paramList
60
+ * @param array|null $paramList
61
61
*
62
62
* @throws JsonRpcInvalidParamsException
63
63
*
64
64
* @return void
65
65
*/
66
- private function validateParamsIfNeeded (JsonRpcMethodInterface $ method , $ paramList )
66
+ private function validateParams (JsonRpcMethodInterface $ method , array $ paramList = null )
67
67
{
68
- if (is_array ($ paramList )) {
69
- $ violationList = $ method ->validateParams ($ paramList );
68
+ $ violationList = $ method ->validateParams ($ paramList ?? []);
70
69
71
- if (count ($ violationList )) {
72
- throw new JsonRpcInvalidParamsException ($ violationList );
73
- }
70
+ if (count ($ violationList )) {
71
+ throw new JsonRpcInvalidParamsException ($ violationList );
74
72
}
75
73
}
76
74
}
0 commit comments