aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Calculator.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/NXP/Classes/Calculator.php')
-rw-r--r--src/NXP/Classes/Calculator.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/NXP/Classes/Calculator.php b/src/NXP/Classes/Calculator.php
index 4785a8f..a8f16af 100644
--- a/src/NXP/Classes/Calculator.php
+++ b/src/NXP/Classes/Calculator.php
@@ -44,7 +44,7 @@ class Calculator
/**
* Calculate array of tokens in reverse polish notation
* @param Token[] $tokens
- * @param array $variables
+ * @param array<string, float|string> $variables
* @return mixed
* @throws IncorrectExpressionException
* @throws UnknownVariableException
@@ -68,7 +68,7 @@ class Calculator
throw new UnknownVariableException($variable);
}
- $stack[] = new Token(Token::Literal, $value);
+ $stack[] = new Token(Token::Literal, $value, $variable);
} elseif ($token->type === Token::Function) {
if (!array_key_exists($token->value, $this->functions)) {
throw new UnknownFunctionException($token->value);