Skip to content

Commit 1ed4504

Browse files
committed
Improve json value printer
1 parent 4a607ab commit 1ed4504

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Exception/Value/JsonLikeValuePrinter.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,8 @@ private function printFloat(float $value): string
151151
*/
152152
private function printWellFormedFloat(float $value): string
153153
{
154-
/** @var non-empty-string $formatted */
155-
$formatted = \rtrim(\sprintf('%f', $value), '0');
156-
157-
if (\str_ends_with($formatted, '.')) {
158-
$formatted .= '0';
159-
}
160-
161-
return $formatted;
154+
/** @var non-empty-string */
155+
return \sprintf('%h', $value);
162156
}
163157

164158
/**

0 commit comments

Comments
 (0)