Skip to content

Commit 16468fd

Browse files
authored
Fix incorrect formatting of multipleOf in error message
- `%d` casts the multipleOf to a whole number even if its a float with decimals - `%f` would add unnecessary decimals, e.g. `0.01` would become `0.010000` - `%s` maintains the same number of decimals, e.g. `0.01` stays `0.01`
1 parent 761c47a commit 16468fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Schema/Type/Number.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function validate(mixed $value, callable $fail): void
5959
$this->multipleOf !== null &&
6060
(float) ($value / $this->multipleOf) !== round($value / $this->multipleOf)
6161
) {
62-
$fail(sprintf('must be a multiple of %d', $this->multipleOf));
62+
$fail(sprintf('must be a multiple of %s', $this->multipleOf));
6363
}
6464
}
6565

0 commit comments

Comments
 (0)