Skip to content

Commit 85063f6

Browse files
committed
改进int和float验证规则
1 parent c6a7704 commit 85063f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Validate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,8 @@ public function is($value, string $rule, array $data = []): bool
11801180
'number' => is_numeric($value),
11811181
'alphaNum' => ctype_alnum((string)$value),
11821182
'array' => is_array($value),
1183-
'integer', 'int' => is_int($value),
1184-
'float' => is_float($value),
1183+
'integer', 'int' => is_numeric($value) && is_int((int)$value),
1184+
'float' => is_numeric($value) && is_float((float)$value),
11851185
'string' => is_string($value),
11861186
'file' => $value instanceof File,
11871187
'image' => $value instanceof File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6, 9, 10, 11, 14, 15, 17, 18]),

0 commit comments

Comments
 (0)