Skip to content

Commit 72ba5d1

Browse files
committed
Merge branch 'hotfix/2.0.1'
2 parents f3e7dc5 + 777b783 commit 72ba5d1

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/App/Manager/MethodManager.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function __construct(MethodResolverInterface $methodResolver, CustomExcep
2929
}
3030

3131
/**
32-
* @param string $methodName
33-
* @param array $paramList
32+
* @param string $methodName
33+
* @param array|null $paramList
3434
*
3535
* @return mixed
3636
*
@@ -46,7 +46,7 @@ public function apply(string $methodName, array $paramList = null)
4646
throw new JsonRpcMethodNotFoundException($methodName);
4747
}
4848

49-
$this->validateParamsIfNeeded($method, $paramList);
49+
$this->validateParams($method, $paramList);
5050

5151
try {
5252
return $method->apply($paramList);
@@ -57,20 +57,18 @@ public function apply(string $methodName, array $paramList = null)
5757

5858
/**
5959
* @param JsonRpcMethodInterface $method
60-
* @param array|mixed $paramList
60+
* @param array|null $paramList
6161
*
6262
* @throws JsonRpcInvalidParamsException
6363
*
6464
* @return void
6565
*/
66-
private function validateParamsIfNeeded(JsonRpcMethodInterface $method, $paramList)
66+
private function validateParams(JsonRpcMethodInterface $method, array $paramList = null)
6767
{
68-
if (is_array($paramList)) {
69-
$violationList = $method->validateParams($paramList);
68+
$violationList = $method->validateParams($paramList ?? []);
7069

71-
if (count($violationList)) {
72-
throw new JsonRpcInvalidParamsException($violationList);
73-
}
70+
if (count($violationList)) {
71+
throw new JsonRpcInvalidParamsException($violationList);
7472
}
7573
}
7674
}

0 commit comments

Comments
 (0)