Skip to content

Commit

Permalink
Optimized is-numeric-detection in NumberValue class a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
smuuf committed Nov 6, 2018
1 parent f1556ed commit e357093
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/structures/NumberValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ public static function isNumericInt(string $input) {
}

public static function isNumeric(string $input): bool {
return
(bool) \preg_match('#^[+-]?\d+(\.\d+)?$#', $input)
&& (int) $input !== \PHP_INT_MAX
&& (int) $input !== \PHP_INT_MIN;
return (bool) \preg_match('#^[+-]?\d+(\.\d+)?$#', $input);
}

public function doAddition(Value $right): Value {
Expand Down

0 comments on commit e357093

Please sign in to comment.