aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Marín <javier@marinros.com>2020-09-16 04:08:14 +0300
committerBruce Wells <brucekwells@gmail.com>2020-09-16 04:14:44 +0300
commit80726f2bd5c17b7d17f7da37d7000c3dae33e353 (patch)
treeb7785e26ac4ee3f597a898a8463552170c0f4794
parent8fc77e54e01be2bfc6c2d5938fcd7735d4c9b3dd (diff)
Allow null values in `setVar` method (#73)
* Added handler to define not found variables Added support for string variables Fixed strings and ints comparison error * Check if variables have scalar types (int, float, string and bool) Better $onVarNotFound logic * Better support for null variables * Better support for null variables * Better support for null variables * Allow null values in `setVar` method
-rw-r--r--src/NXP/MathExecutor.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php
index f45335c..b7abcad 100644
--- a/src/NXP/MathExecutor.php
+++ b/src/NXP/MathExecutor.php
@@ -431,7 +431,7 @@ class MathExecutor
*/
public function setVar(string $variable, $value) : self
{
- if (!is_scalar($value)) {
+ if (!is_scalar($value) && $value !== null) {
$type = gettype($value);
throw new MathExecutorException("Variable ({$variable}) type ({$type}) is not scalar");
}