File tree 2 files changed +33
-1
lines changed
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class Money implements Rule
8
8
{
9
9
public const RULE_NAME = 'money ' ;
10
10
11
- private const MONEY_REGEX = '/^(([1-9]\d{0,2})(\d*|(\s\d{3})*)|0)(\.\d{1,4})?$/ ' ;
11
+ private const MONEY_REGEX = '/^-? (([1-9]\d{0,2})(\d*|(\s\d{3})*)|0)(\.\d{1,4})?$/ ' ;
12
12
13
13
public function passes ($ attribute , $ value ): bool
14
14
{
Original file line number Diff line number Diff line change @@ -38,6 +38,38 @@ public function inputsDataProvider(): array
38
38
'input ' => '0.2500 ' ,
39
39
'result ' => true ,
40
40
],
41
+ [
42
+ 'input ' => '-1500 ' ,
43
+ 'result ' => true ,
44
+ ],
45
+ [
46
+ 'input ' => '-1 500 ' ,
47
+ 'result ' => true ,
48
+ ],
49
+ [
50
+ 'input ' => '-1500.0 ' ,
51
+ 'result ' => true ,
52
+ ],
53
+ [
54
+ 'input ' => '-1 500.0 ' ,
55
+ 'result ' => true ,
56
+ ],
57
+ [
58
+ 'input ' => '-0 ' ,
59
+ 'result ' => true ,
60
+ ],
61
+ [
62
+ 'input ' => '-0.0 ' ,
63
+ 'result ' => true ,
64
+ ],
65
+ [
66
+ 'input ' => '-0.2500 ' ,
67
+ 'result ' => true ,
68
+ ],
69
+ [
70
+ 'input ' => '- 500.0 ' ,
71
+ 'result ' => false ,
72
+ ],
41
73
[
42
74
'input ' => '0.25001 ' ,
43
75
'result ' => false ,
You can’t perform that action at this time.
0 commit comments