Skip to content

Commit 7c80129

Browse files
author
Wout Gevaert
committed
Format floats that look like integers as floats
1 parent 17d0ad0 commit 7c80129

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Expressions/Literals/Float_.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ public function getValue(): float
4848
*/
4949
public function toQuery(): string
5050
{
51-
return (string)$this->value;
51+
$value = (string) $this->value;
52+
if (
53+
ctype_digit($value)
54+
|| ($value[0] === '-' && ctype_digit(substr($value,1)) )
55+
) {
56+
$value .= '.0';
57+
}
58+
return $value;
5259
}
5360
}

0 commit comments

Comments
 (0)