Skip to content

Commit 09743db

Browse files
committed
[Yaml] Add 0 to float repr
1 parent 4cbad53 commit 09743db

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public static function dump($value, int $flags = 0): string
175175
} elseif (floor($value) == $value && $repr == $value) {
176176
// Preserve float data type since storing a whole number will result in integer value.
177177
if (false === strpos($repr, 'E')) {
178-
$repr = $repr.'.';
178+
$repr = $repr.'.0';
179179
}
180180
}
181181
} else {

Tests/InlineTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function getTestsForParse()
298298
['12_', 12],
299299
['"quoted string"', 'quoted string'],
300300
["'quoted string'", 'quoted string'],
301-
['1234.', 1234.],
301+
['1234.0', 1234.0],
302302
['12.30e+02', 12.30e+02],
303303
['123.45_67', 123.4567],
304304
['0x4D2', 0x4D2],
@@ -462,7 +462,7 @@ public function getTestsForDump()
462462
['_12', '_12'],
463463
["'12_'", '12_'],
464464
["'quoted string'", 'quoted string'],
465-
['1230.', 12.30e+02],
465+
['1230.0', 12.30e+02],
466466
['1.23E+45', 12.30e+44],
467467
['1234', 0x4D2],
468468
['1243', 02333],

0 commit comments

Comments
 (0)