mirror of
https://github.com/Respect/Validation.git
synced 2024-06-01 13:22:24 +02:00
Fix Decimal rule for float values > 10
This commit is contained in:
parent
3dcd859d98
commit
c7a6f2ebec
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue