From 8aa6674831c7c2329d06b8dc9db7801cb4997695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Mar=C3=ADn?= Date: Wed, 16 Sep 2020 03:08:14 +0200 Subject: [PATCH] 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 --- src/NXP/MathExecutor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ public function getVar(string $variable) */ 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"); }