diff options
author | Bruce Wells <brucekwells@gmail.com> | 2020-05-20 06:16:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 06:16:13 +0300 |
commit | 2c18fbb2452baa1839f9102b309de1967b30307d (patch) | |
tree | bb1049748d4b6f12209d0a868fb17592b85789ea | |
parent | d195b3e909ddcd2f983d303164a1855c3557c7ff (diff) | |
parent | 949334d6c37d384800c639ba9941e94f5157f5ac (diff) |
Merge branch 'master' into neonxp-ng
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/NXP/Classes/CustomFunction.php | 2 | ||||
-rw-r--r-- | src/NXP/MathExecutor.php | 4 |
3 files changed, 3 insertions, 5 deletions
@@ -141,9 +141,7 @@ Or call setDivisionByZeroIsZero ```php echo $executor->setDivisionByZeroIsZero()->execute('1/0'); ``` - If you want another behavior, you can override division operator: - ```php $executor->addOperator("/", false, 180, function($a, $b) { if ($b == 0) { diff --git a/src/NXP/Classes/CustomFunction.php b/src/NXP/Classes/CustomFunction.php index 636435c..bf36405 100644 --- a/src/NXP/Classes/CustomFunction.php +++ b/src/NXP/Classes/CustomFunction.php @@ -32,7 +32,7 @@ class CustomFunction * @param int $places * @throws ReflectionException */ - public function __construct(string $name, callable $function, int $places = null) + public function __construct(string $name, callable $function, ?int $places = null) { $this->name = $name; $this->function = $function; diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php index 5a20e17..5fdc78f 100644 --- a/src/NXP/MathExecutor.php +++ b/src/NXP/MathExecutor.php @@ -30,7 +30,7 @@ class MathExecutor * * @var array */ - private $variables = []; + public $variables = []; /** * @var Operator[] @@ -103,7 +103,7 @@ class MathExecutor '/' => [ function ($a, $b) { if ($b == 0) { - throw new DivisionByZeroException(); + throw new DivisionByZeroException(); } return $a / $b; }, |