Skip to content

Commit

Permalink
Allow null values in setVar method (#73)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
javiermarinros authored Sep 16, 2020
1 parent f8faf3f commit 8aa6674
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NXP/MathExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 8aa6674

Please sign in to comment.