We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03c371a commit 422d5e9Copy full SHA for 422d5e9
src/Input/Number.php
@@ -92,7 +92,7 @@ public function ask() : InputResult
92
93
public function validate(string $input) : bool
94
{
95
- return (bool) preg_match('/^\d+$/', $input);
+ return (bool) preg_match('/^-?\d+$/', $input);
96
}
97
98
public function filter(string $value) : string
test/Input/NumberTest.php
@@ -80,6 +80,11 @@ public function validateProvider() : array
80
['0', true],
81
['0000000000', true],
82
['9999999999', true],
83
+ ['-9999999999', true],
84
+ ['-54', true],
85
+ ['-1', true],
86
+ ['-t10', false],
87
+ ['-t', false],
88
];
89
90
0 commit comments