Merge branch 'scruwi/master' into 2.2

This commit is contained in:
Alexandre Gomes Gaigalas 2023-02-13 19:00:28 -03:00
commit e5223a0913
2 changed files with 5 additions and 1 deletions

View file

@ -70,6 +70,6 @@ final class Decimal extends AbstractRule
return $formatted;
}
return preg_replace('/^(\d.\d)0*/', '$1', $formatted);
return preg_replace('/^(\d+\.\d)0*$/', '$1', $formatted);
}
}

View file

@ -48,6 +48,10 @@ final class DecimalTest extends RuleTestCase
[new Decimal(1), 1.1],
[new Decimal(1), '1.3'],
[new Decimal(1), 1.50],
[new Decimal(1), 10.0],
[new Decimal(2), 10.00],
[new Decimal(1), 10.50],
[new Decimal(2), 10.50],
[new Decimal(3), '1.000'],
[new Decimal(3), 123456789.001],
];