diff options
author | Bruce Wells <phpfui@users.noreply.github.com> | 2018-10-25 18:54:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 18:54:54 +0300 |
commit | 43f0ff3f28d198fbb4e36346fc5f36fa91cf3e18 (patch) | |
tree | 28a0abef9e0e48df01660985339e93c69a2cd746 /src/NXP/Classes/Calculator.php | |
parent | 4a672cfd94c07e1821227f27fd1edd2217685136 (diff) |
Support for better invalid expression detection and divide by zero (#30)
* Additional validation for bad expressions (*+ for example)
* Removing DivisionByZeroException testing for now
Added more unit tests.
Diffstat (limited to 'src/NXP/Classes/Calculator.php')
-rw-r--r-- | src/NXP/Classes/Calculator.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/NXP/Classes/Calculator.php b/src/NXP/Classes/Calculator.php index bfa7015..253e70c 100644 --- a/src/NXP/Classes/Calculator.php +++ b/src/NXP/Classes/Calculator.php @@ -54,7 +54,7 @@ class Calculator } } $result = array_pop($stack); - if (!empty($stack)) { + if ($result === null || ! empty($stack)) { throw new IncorrectExpressionException(); } |