Skip to content

Commit cc6e702

Browse files
committed
refactor: Resolce PHPStan issues in MultipleOfConstraint
1 parent 5a99b87 commit cc6e702

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/JsonSchema/Constraints/Drafts/Draft06/MultipleOfConstraint.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = n
2525
return;
2626
}
2727

28+
if (!is_int($schema->multipleOf) && !is_float($schema->multipleOf) && $schema->multipleOf <= 0.0) {
29+
return;
30+
}
31+
2832
if (!is_int($value) && !is_float($value)) {
2933
return;
3034
}
@@ -45,10 +49,6 @@ private function isMultipleOf($number1, $number2): bool
4549
$modulus = ($number1 - round($number1 / $number2) * $number2);
4650
$precision = 0.0000000001;
4751

48-
if (-$precision < $modulus && $modulus < $precision) {
49-
return true;
50-
}
51-
52-
return false;
52+
return -$precision < $modulus && $modulus < $precision;
5353
}
5454
}

0 commit comments

Comments
 (0)