Merge pull request #91 from Arul-/patch-2
Fix: method validation in both send and call
This commit is contained in:
commit
d0559b8c91
@ -422,8 +422,8 @@ class Contract
|
|||||||
$method = array_splice($arguments, 0, 1)[0];
|
$method = array_splice($arguments, 0, 1)[0];
|
||||||
$callback = array_pop($arguments);
|
$callback = array_pop($arguments);
|
||||||
|
|
||||||
if (!is_string($method) && !isset($this->functions[$method])) {
|
if (!is_string($method) || !isset($this->functions[$method])) {
|
||||||
throw new InvalidArgumentException('Please make sure the method is existed.');
|
throw new InvalidArgumentException('Please make sure the method exists.');
|
||||||
}
|
}
|
||||||
$function = $this->functions[$method];
|
$function = $this->functions[$method];
|
||||||
|
|
||||||
@ -468,8 +468,8 @@ class Contract
|
|||||||
$method = array_splice($arguments, 0, 1)[0];
|
$method = array_splice($arguments, 0, 1)[0];
|
||||||
$callback = array_pop($arguments);
|
$callback = array_pop($arguments);
|
||||||
|
|
||||||
if (!is_string($method) && !isset($this->functions[$method])) {
|
if (!is_string($method) || !isset($this->functions[$method])) {
|
||||||
throw new InvalidArgumentException('Please make sure the method is existed.');
|
throw new InvalidArgumentException('Please make sure the method exists.');
|
||||||
}
|
}
|
||||||
$function = $this->functions[$method];
|
$function = $this->functions[$method];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user