Skip to content

Commit

Permalink
Merge branch 'master' into codito/symfony-var-dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Feb 2, 2024
2 parents 18cd993 + dfa0084 commit 425377b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer/Basic/NumericLiteralSeparatorFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private function formatValue(string $value): string
/** If its a negative value we need an offset */
$negativeOffset = static fn ($v) => str_contains($v, '-') ? 1 : 0;

Preg::matchAll('/([0-9-_]+)?((\.)([0-9_]+))?((e)([0-9-_]+))?/i', $value, $result);
Preg::matchAll('/([0-9-_]+)?((\.)([0-9_]*))?((e)([0-9-_]+))?/i', $value, $result);

$integer = $result[1][0];
$joinedValue = $this->insertEveryRight($integer, 3, $negativeOffset($integer));
Expand Down
2 changes: 2 additions & 0 deletions tests/Fixer/Basic/NumericLiteralSeparatorFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public static function provideFixCases(): iterable
'01234567' => '01_234_567',
],
]);

yield 'do not change float to int when there is nothing after the dot' => ['<?php $x = 100.;'];
}

/**
Expand Down

0 comments on commit 425377b

Please sign in to comment.