Skip to content

Commit

Permalink
Merge branch '1.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Jun 6, 2024
2 parents 29bbf07 + 52af863 commit ae8f87e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/BCMath.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,13 @@ public static function __callStatic($name, $arguments)
'sqrt' => 2,
'sub' => 3
];
if (count($arguments) < $params[$name] - 1) {
$cnt = count($arguments);
if ($cnt < $params[$name] - 1) {
$min = $params[$name] - 1;
throw new \ArgumentCountError("bc$name() expects at least $min parameters, " . func_num_args() . " given");
throw new \ArgumentCountError("bc$name() expects at least $min parameters, " . $cnt . " given");
}
if (count($arguments) > $params[$name]) {
$str = "bc$name() expects at most {$params[$name]} parameters, " . func_num_args() . " given";
if ($cnt > $params[$name]) {
$str = "bc$name() expects at most {$params[$name]} parameters, " . $cnt . " given";
throw new \ArgumentCountError($str);
}
$numbers = array_slice($arguments, 0, $params[$name] - 1);
Expand Down

0 comments on commit ae8f87e

Please sign in to comment.