From aa8ffe19f2eb6f194b3e6ee1aac4c2706659e6b9 Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 4 Jun 2020 11:43:16 -0400 Subject: Variable fixes (#67) * Reproduce if throws UnknownOperatorException * Fix variable detection * Adding IncorrectNumberOfFunctionParametersException * Removing tabs * Better exception message text --- src/NXP/Classes/CustomFunction.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/NXP/Classes/CustomFunction.php') diff --git a/src/NXP/Classes/CustomFunction.php b/src/NXP/Classes/CustomFunction.php index 06e21ef..f127ad2 100644 --- a/src/NXP/Classes/CustomFunction.php +++ b/src/NXP/Classes/CustomFunction.php @@ -3,7 +3,7 @@ namespace NXP\Classes; -use NXP\Exception\IncorrectExpressionException; +use NXP\Exception\IncorrectNumberOfFunctionParametersException; use ReflectionException; use ReflectionFunction; @@ -30,6 +30,7 @@ class CustomFunction * @param callable $function * @param int $places * @throws ReflectionException + * @throws IncorrectNumberOfFunctionParametersException */ public function __construct(string $name, callable $function, ?int $places = null) { @@ -46,7 +47,7 @@ class CustomFunction public function execute(array &$stack) : Token { if (count($stack) < $this->places) { - throw new IncorrectExpressionException(); + throw new IncorrectNumberOfFunctionParametersException($this->name); } $args = []; for ($i = 0; $i < $this->places; $i++) { -- cgit v1.2.3